activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jose MarĂ­a Zaragoza <demablo...@gmail.com>
Subject Questions about PooledConnectionFactory in AMQ 5.8
Date Tue, 19 Nov 2013 15:52:53 GMT
Hello:

I'm using AMQ 5.8 and I've got some questions about PooledConnectionFactory:


This is my testing configuration , running in JVM 6

// ConnectionFactory
ActiveMQConnectionFactory connectionFactory = new
ActiveMQConnectionFactory("failover:(tcp://broker1:61616?connectionTimeout=3000,tcp://broker2:61616?connectionTimeout=3000)?timeout=5000&startupMaxReconnectAttempts=1&maxReconnectAttempts=1&randomize=false&priorityBackup=false");

//PooledConnectionFactory  ( size 1 )
PooledConnectionFactory pooledConnectionFactory = new
PooledConnectionFactory(connectionFactory);
pooledConnectionFactory.setMaxConnections(1);

Connection connection1 = pooledConnectionFactory.createConnection();
Connection connection2 = pooledConnectionFactory.createConnection();


1)

I've checked that connection1 != connection2  , i.e., they are
different instances  , does't it make any sense ?
Pool size is 1 , so I would wait that they were the same instance


2)

I've checked that if connection1 is started ( connection1.start() ) ,
connection2 doesn't require to execute connection2.start()
So, I guess that connection1  and connection2 share something but they
aren't "the same thing "

3)

I've checked that connection1.stop() or connection2.stop() ( i guess
that over any PooledConnection ) don't do anything
I wonder why , though it's not a problem for me


4)

I've checked that connection1.close() only has effect on consumers
created on connection1 , and connection2.close() only has effect on
consumers created on connection2. So, it seems they are different
things.
But if I has got only one connection in pool, how I can close *that*
connection ? ( I don't want to close all of then with clear() method
on PooledConnectionFactory, but I want to close a single connection )


Thanks and regards

Mime
View raw message