I was thinking about something like this:
public void testSetGetExceptionListener2() throws Exception {
PooledConnectionFactory pcf = new PooledConnectionFactory();
pcf.setConnectionFactory(new
ActiveMQConnectionFactory("vm://test"));
TopicConnection conn1 = (TopicConnection) pcf.createConnection();
ExceptionListener listener = new ExceptionListener() {
public void onException(JMSException exception) {
}
};
conn1.setExceptionListener(listener);
TopicConnection conn2 = (TopicConnection) pcf.createConnection();
ExceptionListener listener = new ExceptionListener() {
public void onException(JMSException exception) {
}
};
conn2.setExceptionListener(listener);
assertEquals(listener, conn1.getExceptionListener());
assertEquals(listener, conn2.getExceptionListener());
}
Now the first assertion will fail.
Gary Tully wrote:
>
> Have a look at the testSetGetExceptionListener() test in
> http://svn.apache.org/viewvc/activemq/trunk/activemq-pool/src/test/java/org/apache/activemq/pool/PooledTopicPublisherTest.java?view=markup
>
> It proves that set/get works. If there is a close in the meantime, there
> is
> no guarantee that you get the same connection, so an exception listener
> needs to be set after every createConnection() call.
>
>
> 2009/4/10 Lukasz Zielinski <[email protected]>
>
>>
>> Hi,
>>
>> >ok, but an setExceptionListener is supposed to be per connection as per
>> the
>> >JMS spec.
>>
>> Right and since PooledConnection implements JMS interfaces I expect that
>> ExceptionListener will be set per PooledConnection, otherwise code using
>> PCF
>> must know that it is special and shouldn't rely on ExceptionListener. In
>> other words when I call setExceptionListener on connection and later
>> getExceptionListener should return the same listener which it doesn't.
>>
>> Regards,
>> LZ
>>
>> --
>> View this message in context:
>> http://www.nabble.com/PooledConnectionFactory-and-consumer-pooling-tp22952902p22987682.html
>> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
>>
>>
>
>
> --
> http://blog.garytully.com
>
> Open Source SOA
> http://FUSESource.com
>
>
--
View this message in context:
http://www.nabble.com/PooledConnectionFactory-and-consumer-pooling-tp22952902p22993300.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.