public class ConnectionFactoryWrapper extends java.lang.Object implements javax.jms.ConnectionFactory, MatsFactory.MatsWrapper<javax.jms.ConnectionFactory>
ConnectionFactory
, which simply implements ConnectionFactory, takes a
ConnectionFactory instance and forwards all calls to that. Meant to be extended to add extra functionality, e.g.
Spring integration.Constructor and Description |
---|
ConnectionFactoryWrapper()
No-args constructor, which implies that you either need to invoke
setWrappee(ConnectionFactory) before
publishing the instance (making it available for other threads), or override unwrap() to provide the
desired ConnectionFactory instance. |
ConnectionFactoryWrapper(javax.jms.ConnectionFactory targetConnectionFactory)
Standard constructor, taking the wrapped
ConnectionFactory instance. |
Modifier and Type | Method and Description |
---|---|
javax.jms.Connection |
createConnection() |
javax.jms.Connection |
createConnection(java.lang.String userName,
java.lang.String password) |
void |
setWrappee(javax.jms.ConnectionFactory targetConnectionFactory)
Sets the wrapped
ConnectionFactory , e.g. |
javax.jms.ConnectionFactory |
unwrap() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
unwrapFully, unwrapTo
public ConnectionFactoryWrapper(javax.jms.ConnectionFactory targetConnectionFactory)
ConnectionFactory
instance.targetConnectionFactory
- the ConnectionFactory
instance which unwrap()
will return (and hence all forwarded
methods will use).public ConnectionFactoryWrapper()
setWrappee(ConnectionFactory)
before
publishing the instance (making it available for other threads), or override unwrap()
to provide the
desired ConnectionFactory
instance. In these cases, make sure to honor memory visibility semantics - i.e.
establish a happens-before edge between the setting of the instance and any other threads getting it.public void setWrappee(javax.jms.ConnectionFactory targetConnectionFactory)
ConnectionFactory
, e.g. in case you instantiated it with the no-args constructor. Do
note that the field holding the wrapped instance is not volatile nor synchronized. This means that if you
want to set it after it has been published to other threads, you will have to override both this method and
unwrap()
to provide for needed memory visibility semantics, i.e. establish a happens-before edge between
the setting of the instance and any other threads getting it.setWrappee
in interface MatsFactory.MatsWrapper<javax.jms.ConnectionFactory>
targetConnectionFactory
- the ConnectionFactory
which is returned by unwrap()
, unless that is overridden.public javax.jms.ConnectionFactory unwrap()
unwrap
in interface MatsFactory.MatsWrapper<javax.jms.ConnectionFactory>
ConnectionFactory
. All forwarding methods invokes this method to get the wrapped
ConnectionFactory
, thus if you want to get creative wrt. how and when the ConnectionFactory is
decided, you can override this method.public javax.jms.Connection createConnection() throws javax.jms.JMSException
createConnection
in interface javax.jms.ConnectionFactory
javax.jms.JMSException
public javax.jms.Connection createConnection(java.lang.String userName, java.lang.String password) throws javax.jms.JMSException
createConnection
in interface javax.jms.ConnectionFactory
javax.jms.JMSException