Merge remote-tracking branch 'origin/jetty-7' into jetty-8

This commit is contained in:
Greg Wilkins 2013-09-12 12:30:03 +10:00
commit de544ddfbf
2 changed files with 17 additions and 4 deletions

View File

@ -49,7 +49,15 @@ import org.eclipse.jetty.util.thread.ShutdownThread;
public class MBeanContainer extends AbstractLifeCycle implements Container.Listener, Dumpable
{
private final static Logger LOG = Log.getLogger(MBeanContainer.class.getName());
private final static HashMap<String, Integer> _unique = new HashMap<String, Integer>();
private final static HashMap<String, Integer> __unique = new HashMap<String, Integer>();
public final static void resetUnique()
{
synchronized (__unique)
{
__unique.clear();
}
}
private final MBeanServer _server;
private final WeakHashMap<Object, ObjectName> _beans = new WeakHashMap<Object, ObjectName>();
@ -283,9 +291,13 @@ public class MBeanContainer extends AbstractLifeCycle implements Container.Liste
}
String basis = buf.toString();
Integer count = _unique.get(basis);
count = count == null ? 0 : 1 + count;
_unique.put(basis, count);
Integer count;
synchronized (__unique)
{
count = __unique.get(basis);
count = count == null ? 0 : 1 + count;
__unique.put(basis, count);
}
//if no explicit domain, create one
String domain = _domain;

View File

@ -97,6 +97,7 @@ public class AttrEventTriggerTest
MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer);
mBeanContainer.addBean(Log.getLog());
MBeanContainer.resetUnique();
_counter = _handler.getRequestCounter();
mBeanContainer.addBean(_counter);