Fix for AMQ-1106: PooledBrokerFactoryBean incorrectly compares broker config resources

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/branches/activemq-4.1@489409 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrian T. Co 2006-12-21 17:12:07 +00:00
parent 08a32a93b9
commit 213ffce94d
1 changed files with 5 additions and 5 deletions

View File

@ -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();
}