diff --git a/activemq-core/src/main/java/org/apache/activemq/xbean/PooledBrokerFactoryBean.java b/activemq-core/src/main/java/org/apache/activemq/xbean/PooledBrokerFactoryBean.java index f5eadd0673..c3dbd9e92e 100644 --- a/activemq-core/src/main/java/org/apache/activemq/xbean/PooledBrokerFactoryBean.java +++ b/activemq-core/src/main/java/org/apache/activemq/xbean/PooledBrokerFactoryBean.java @@ -47,14 +47,14 @@ public class PooledBrokerFactoryBean implements FactoryBean, InitializingBean, D public void afterPropertiesSet() throws Exception { synchronized( sharedBrokerMap ) { - SharedBroker sharedBroker = (SharedBroker) sharedBrokerMap.get(config); + SharedBroker sharedBroker = (SharedBroker) sharedBrokerMap.get(config.getFilename()); if( sharedBroker == null ) { sharedBroker = new SharedBroker(); sharedBroker.factory = new BrokerFactoryBean(); sharedBroker.factory.setConfig(config); sharedBroker.factory.setStart(start); sharedBroker.factory.afterPropertiesSet(); - sharedBrokerMap.put(config, sharedBroker); + sharedBrokerMap.put(config.getFilename(), sharedBroker); } sharedBroker.refCount++; } @@ -62,12 +62,12 @@ public class PooledBrokerFactoryBean implements FactoryBean, InitializingBean, D public void destroy() throws Exception { synchronized( sharedBrokerMap ) { - SharedBroker sharedBroker = (SharedBroker) sharedBrokerMap.get(config); + SharedBroker sharedBroker = (SharedBroker) sharedBrokerMap.get(config.getFilename()); if( sharedBroker != null ) { sharedBroker.refCount--; if( sharedBroker.refCount==0 ) { sharedBroker.factory.destroy(); - sharedBrokerMap.remove(config); + sharedBrokerMap.remove(config.getFilename()); } } } @@ -79,7 +79,7 @@ public class PooledBrokerFactoryBean implements FactoryBean, InitializingBean, D public Object getObject() throws Exception { synchronized( sharedBrokerMap ) { - SharedBroker sharedBroker = (SharedBroker) sharedBrokerMap.get(config); + SharedBroker sharedBroker = (SharedBroker) sharedBrokerMap.get(config.getFilename()); if( sharedBroker != null ) { return sharedBroker.factory.getObject(); }