/***This was changed 11/24/06 to fix syncronization problems reported as bug */ private synchronized MonitorImp getMonitor(MonKey key, boolean isPrimary, boolean isTimeMonitor) { // note using MonKey over String concatenation doubled the speed // of the code, and was only slightly slower than using just the label // as the key MonitorImp mon=getExistingMonitor(key); // chance of 2 threads going into the next code simultaneously if (mon==null) { mon=createMon(key, isPrimary, isTimeMonitor); putMon(key, mon); } if (mon.isEnabled()) { mon = (isTimeMonitor) ? new TimeMon(key, mon.getMonInternals()) : new DecoMon(key, mon.getMonInternals()); } return mon; }