mirror of https://github.com/apache/activemq.git
Fix for AMQ-1106: PooledBrokerFactoryBean incorrectly compares broker config resources
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@489413 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
958c41a12b
commit
2b903d446a
|
@ -47,14 +47,14 @@ public class PooledBrokerFactoryBean implements FactoryBean, InitializingBean, D
|
||||||
|
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() throws Exception {
|
||||||
synchronized( sharedBrokerMap ) {
|
synchronized( sharedBrokerMap ) {
|
||||||
SharedBroker sharedBroker = (SharedBroker) sharedBrokerMap.get(config);
|
SharedBroker sharedBroker = (SharedBroker) sharedBrokerMap.get(config.getFilename());
|
||||||
if( sharedBroker == null ) {
|
if( sharedBroker == null ) {
|
||||||
sharedBroker = new SharedBroker();
|
sharedBroker = new SharedBroker();
|
||||||
sharedBroker.factory = new BrokerFactoryBean();
|
sharedBroker.factory = new BrokerFactoryBean();
|
||||||
sharedBroker.factory.setConfig(config);
|
sharedBroker.factory.setConfig(config);
|
||||||
sharedBroker.factory.setStart(start);
|
sharedBroker.factory.setStart(start);
|
||||||
sharedBroker.factory.afterPropertiesSet();
|
sharedBroker.factory.afterPropertiesSet();
|
||||||
sharedBrokerMap.put(config, sharedBroker);
|
sharedBrokerMap.put(config.getFilename(), sharedBroker);
|
||||||
}
|
}
|
||||||
sharedBroker.refCount++;
|
sharedBroker.refCount++;
|
||||||
}
|
}
|
||||||
|
@ -62,12 +62,12 @@ public class PooledBrokerFactoryBean implements FactoryBean, InitializingBean, D
|
||||||
|
|
||||||
public void destroy() throws Exception {
|
public void destroy() throws Exception {
|
||||||
synchronized( sharedBrokerMap ) {
|
synchronized( sharedBrokerMap ) {
|
||||||
SharedBroker sharedBroker = (SharedBroker) sharedBrokerMap.get(config);
|
SharedBroker sharedBroker = (SharedBroker) sharedBrokerMap.get(config.getFilename());
|
||||||
if( sharedBroker != null ) {
|
if( sharedBroker != null ) {
|
||||||
sharedBroker.refCount--;
|
sharedBroker.refCount--;
|
||||||
if( sharedBroker.refCount==0 ) {
|
if( sharedBroker.refCount==0 ) {
|
||||||
sharedBroker.factory.destroy();
|
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 {
|
public Object getObject() throws Exception {
|
||||||
synchronized( sharedBrokerMap ) {
|
synchronized( sharedBrokerMap ) {
|
||||||
SharedBroker sharedBroker = (SharedBroker) sharedBrokerMap.get(config);
|
SharedBroker sharedBroker = (SharedBroker) sharedBrokerMap.get(config.getFilename());
|
||||||
if( sharedBroker != null ) {
|
if( sharedBroker != null ) {
|
||||||
return sharedBroker.factory.getObject();
|
return sharedBroker.factory.getObject();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue