Uniquify the registered MXBean by adding an instanceNumber=... tag to the
ObjectName. In the Queue-enabled future, we might want to come up with GUIDs (or at least semi-unique IDs) so that we could use JMX to track runtime attributes for multiple jobs running simultaneously. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3825 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
5a1a3fc79a
commit
40a963541d
|
|
@ -30,6 +30,11 @@ import net.sf.picard.reference.IndexedFastaSequenceFile;
|
|||
* Requires a special walker tagged with a 'TreeReducible' interface.
|
||||
*/
|
||||
public class HierarchicalMicroScheduler extends MicroScheduler implements HierarchicalMicroSchedulerMBean, ReduceTree.TreeReduceNotifier {
|
||||
/**
|
||||
* Counts the number of instances of the class that are currently alive.
|
||||
*/
|
||||
private static int instanceNumber = 0;
|
||||
|
||||
/**
|
||||
* How many outstanding output merges are allowed before the scheduler stops
|
||||
* allowing new processes and starts merging flat-out.
|
||||
|
|
@ -85,9 +90,17 @@ public class HierarchicalMicroScheduler extends MicroScheduler implements Hierar
|
|||
|
||||
this.threadPool = Executors.newFixedThreadPool(nThreadsToUse);
|
||||
|
||||
// JMX does not allow multiple instances with the same ObjectName to be registered with the same platform MXBean.
|
||||
// To get around this limitation and since we have no job identifier at this point, register a simple counter that
|
||||
// will count the number of instances of this object that have been created in this JVM.
|
||||
int thisInstance;
|
||||
synchronized(HierarchicalMicroScheduler.class) {
|
||||
thisInstance = instanceNumber++;
|
||||
}
|
||||
|
||||
try {
|
||||
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
|
||||
ObjectName name = new ObjectName("org.broadinstitute.sting.gatk.executive:type=HierarchicalMicroScheduler");
|
||||
ObjectName name = new ObjectName("org.broadinstitute.sting.gatk.executive:type=HierarchicalMicroScheduler,instanceNumber="+thisInstance);
|
||||
mbs.registerMBean(this, name);
|
||||
}
|
||||
catch (JMException ex) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue