[
https://issues.apache.org/activemq/browse/AMQ-2225?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Lukasz Zielinski updated AMQ-2225:
----------------------------------
Description:
When multiple connections are obtained from PooledConnectionFactory and
ExceptionListeners are set for them only one ExceptionListener will be notified
about connection problems. Issue is caused by overwriting listeners in shared
connection.
Test case based on
http://svn.apache.org/viewvc/activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/pool/PooledTopicPublisherTest.java?view=markup
public void testSetGetExceptionListener2() throws Exception {
PooledConnectionFactory pcf = new PooledConnectionFactory();
pcf.setConnectionFactory(new ActiveMQConnectionFactory("vm://test"));
TopicConnection conn1 = (TopicConnection) pcf.createConnection();
ExceptionListener list1 = new ExceptionListener() {
public void onException(JMSException exception) {
}
};
conn1.setExceptionListener(list1);
TopicConnection conn2 = (TopicConnection) pcf.createConnection();
ExceptionListener list2 = new ExceptionListener() {
public void onException(JMSException exception) {
}
};
conn2.setExceptionListener(list2);
assertEquals(list1, conn1.getExceptionListener());//this assertion will
fail
assertEquals(list2, conn2.getExceptionListener());//this assertion will
pass
assertEquals(list2, conn1.getExceptionListener());// THE PROBLEM - this
will pass
}
was:
When multiple connections are obtained from PooledConnectionFactory and
ExceptionListeners are set for them only one ExceptionListener will be notified
about connection problems. Issue is caused by overwriting listeners in shared
connection.
Test case based on
http://svn.apache.org/viewvc/activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/pool/PooledTopicPublisherTest.java?view=markup
public void testSetGetExceptionListener2() throws Exception {
PooledConnectionFactory pcf = new PooledConnectionFactory();
pcf.setConnectionFactory(new ActiveMQConnectionFactory("vm://test"));
TopicConnection conn1 = (TopicConnection) pcf.createConnection();
ExceptionListener list1 = new ExceptionListener() {
public void onException(JMSException exception) {
}
};
conn1.setExceptionListener(list1);
TopicConnection conn2 = (TopicConnection) pcf.createConnection();
ExceptionListener list2 = new ExceptionListener() {
public void onException(JMSException exception) {
}
};
conn2.setExceptionListener(list2);
assertEquals(list1, conn1.getExceptionListener());//this assertion will
fail
assertEquals(list2, conn2.getExceptionListener());//this assertion will
pass
assertEquals(list2, conn1.getExceptionListener());// THE PROBLEM
}
> PooledConnection obtaind from PooledConnectionFactory overwrites
> ExceptionListener
> ----------------------------------------------------------------------------------
>
> Key: AMQ-2225
> URL: https://issues.apache.org/activemq/browse/AMQ-2225
> Project: ActiveMQ
> Issue Type: Bug
> Components: Broker
> Affects Versions: 5.2.0
> Reporter: Lukasz Zielinski
> Priority: Critical
>
> When multiple connections are obtained from PooledConnectionFactory and
> ExceptionListeners are set for them only one ExceptionListener will be
> notified about connection problems. Issue is caused by overwriting listeners
> in shared connection.
> Test case based on
> http://svn.apache.org/viewvc/activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/pool/PooledTopicPublisherTest.java?view=markup
> public void testSetGetExceptionListener2() throws Exception {
> PooledConnectionFactory pcf = new PooledConnectionFactory();
> pcf.setConnectionFactory(new ActiveMQConnectionFactory("vm://test"));
> TopicConnection conn1 = (TopicConnection) pcf.createConnection();
> ExceptionListener list1 = new ExceptionListener() {
> public void onException(JMSException exception) {
> }
> };
> conn1.setExceptionListener(list1);
> TopicConnection conn2 = (TopicConnection) pcf.createConnection();
> ExceptionListener list2 = new ExceptionListener() {
> public void onException(JMSException exception) {
> }
> };
> conn2.setExceptionListener(list2);
> assertEquals(list1, conn1.getExceptionListener());//this assertion
> will fail
> assertEquals(list2, conn2.getExceptionListener());//this assertion
> will pass
> assertEquals(list2, conn1.getExceptionListener());// THE PROBLEM -
> this will pass
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.