keenan
09-12-2008, 09:52 PM
The documentation in SingleConnectionFactory (super class for CachingConnectionFactory) states:
/// A ConnectionFactory adapter that returns the same Connection
/// from all CreateConnection() calls, and ignores calls to
/// Connection.Close(). According to the JMS Connection
/// model, this is perfectly thread-safe.
While this is true for JMS connections, it does not appear to be true for ActiveMQ connections:
ActiveMQ.Connection (http://activemq.apache.org/nms/ndoc/ActiveMQ.Connection.html) in NMS API
Thread Safety
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
Does this mean I should mark the CachingConnectionFactory object as singleton=false in my configuration so that every class who needs a reference gets a unique instance?
/// A ConnectionFactory adapter that returns the same Connection
/// from all CreateConnection() calls, and ignores calls to
/// Connection.Close(). According to the JMS Connection
/// model, this is perfectly thread-safe.
While this is true for JMS connections, it does not appear to be true for ActiveMQ connections:
ActiveMQ.Connection (http://activemq.apache.org/nms/ndoc/ActiveMQ.Connection.html) in NMS API
Thread Safety
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
Does this mean I should mark the CachingConnectionFactory object as singleton=false in my configuration so that every class who needs a reference gets a unique instance?