Class OutboundConnection
- java.lang.Object
-
- org.objectweb.joram.client.connector.OutboundConnection
-
- All Implemented Interfaces:
AutoCloseable,Connection,OutboundConnectionMBean
- Direct Known Subclasses:
OutboundQueueConnection,OutboundTopicConnection
public class OutboundConnection extends Object implements Connection, OutboundConnectionMBean
AnOutboundConnectioninstance is a handler for a physical connection to an underlying JORAM server, allowing a component to transparently use this physical connection possibly within a transaction (local or global).
-
-
Field Summary
Fields Modifier and Type Field Description private static booleanDEBUGprivate static Loggerlogger(package private) ManagedConnectionImplmanagedCxThe managed connection this "handle" belongs to.(package private) Vector<OutboundSession>sessionsVector of the connection's sessions.(package private) booleanvalidtrueif this "handle" is valid.(package private) XAConnectionxacThe physical connection this "handle" handles.
-
Constructor Summary
Constructors Constructor Description OutboundConnection(ManagedConnectionImpl managedCx, XAConnection xac)Constructs anOutboundConnectioninstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanup()Close all sessions.voidclose()Requests to close the physical connection.booleancnxEquals(Object obj)Returnstrueif the parameter is aConnectioninstance sharing the same proxy identifier and connection key.ConnectionConsumercreateConnectionConsumer(Destination destination, String messageSelector, ServerSessionPool sessionPool, int maxMessages)Forbidden call on an application or component's outbound connection, throws aIllegalStateExceptioninstance.ConnectionConsumercreateDurableConnectionConsumer(Topic topic, String subscriptionName, String messageSelector, ServerSessionPool sessionPool, int maxMessages)Forbidden call on an application or component's outbound connection, throws aIllegalStateExceptioninstance.(package private) SessioncreateManagedSession(int acknowledgeMode)SessioncreateSession()SessioncreateSession(boolean transacted, int acknowledgeMode)Returns the unique authorized JMS session per connection wrapped in anOutboundSessioninstance.SessioncreateSession(int sessionMode)ConnectionConsumercreateSharedConnectionConsumer(Topic topic, String subscriptionName, String messageSelector, ServerSessionPool sessionPool, int maxMessages)ConnectionConsumercreateSharedDurableConnectionConsumer(Topic topic, String subscriptionName, String messageSelector, ServerSessionPool sessionPool, int maxMessages)StringgetClientID()Forbidden call on an application or component's outbound connection, throws aIllegalStateExceptioninstance.ExceptionListenergetExceptionListener()Forbidden call on an application or component's outbound connection, throws aIllegalStateExceptioninstance.StringgetJMXBeanName(XAConnection cnx)ConnectionMetaDatagetMetaData()Delegates the call to the wrapped JMS connection.intgetNumberOfSession()String[]getSessions()StringregisterMBean()voidsetClientID(String clientID)Forbidden call on an application or component's outbound connection, throws aIllegalStateExceptioninstance.voidsetExceptionListener(ExceptionListener listener)Forbidden call on an application or component's outbound connection, throws aIllegalStateExceptioninstance.voidstart()Delegates the call to the wrapped JMS connection.voidstop()Forbidden call on an application or component's outbound connection, throws aIllegalStateExceptioninstance.StringtoString()voidunregisterMBean()
-
-
-
Field Detail
-
logger
private static final Logger logger
-
DEBUG
private static final boolean DEBUG
-
managedCx
ManagedConnectionImpl managedCx
The managed connection this "handle" belongs to.
-
xac
XAConnection xac
The physical connection this "handle" handles.
-
valid
boolean valid
trueif this "handle" is valid.
-
sessions
Vector<OutboundSession> sessions
Vector of the connection's sessions.
-
-
Constructor Detail
-
OutboundConnection
OutboundConnection(ManagedConnectionImpl managedCx, XAConnection xac)
Constructs anOutboundConnectioninstance.- Parameters:
managedCx- The managed connection building the handle.xac- The underlying physical connection to handle.
-
-
Method Detail
-
cnxEquals
public boolean cnxEquals(Object obj)
Returnstrueif the parameter is aConnectioninstance sharing the same proxy identifier and connection key.
-
cleanup
public void cleanup()
Close all sessions.
-
createSession
public Session createSession() throws JMSException
- Specified by:
createSessionin interfaceConnection- Throws:
JMSException
-
createSession
public Session createSession(int sessionMode) throws JMSException
- Specified by:
createSessionin interfaceConnection- Throws:
JMSException
-
createSession
public Session createSession(boolean transacted, int acknowledgeMode) throws JMSException
Returns the unique authorized JMS session per connection wrapped in anOutboundSessioninstance.- Specified by:
createSessionin interfaceConnection- Throws:
IllegalStateException- If the handle is invalid.JMSException- Generic exception.
-
createManagedSession
Session createManagedSession(int acknowledgeMode) throws JMSException
- Throws:
JMSException
-
getClientID
public String getClientID() throws JMSException
Forbidden call on an application or component's outbound connection, throws aIllegalStateExceptioninstance.- Specified by:
getClientIDin interfaceConnection- Throws:
JMSException
-
setClientID
public void setClientID(String clientID) throws JMSException
Forbidden call on an application or component's outbound connection, throws aIllegalStateExceptioninstance.- Specified by:
setClientIDin interfaceConnection- Throws:
JMSException
-
getMetaData
public ConnectionMetaData getMetaData() throws JMSException
Delegates the call to the wrapped JMS connection.- Specified by:
getMetaDatain interfaceConnection- Throws:
IllegalStateException- If the handle is invalid.JMSException- Generic exception.
-
getExceptionListener
public ExceptionListener getExceptionListener() throws JMSException
Forbidden call on an application or component's outbound connection, throws aIllegalStateExceptioninstance.- Specified by:
getExceptionListenerin interfaceConnection- Throws:
JMSException
-
setExceptionListener
public void setExceptionListener(ExceptionListener listener) throws JMSException
Forbidden call on an application or component's outbound connection, throws aIllegalStateExceptioninstance.- Specified by:
setExceptionListenerin interfaceConnection- Throws:
JMSException
-
start
public void start() throws JMSExceptionDelegates the call to the wrapped JMS connection.- Specified by:
startin interfaceConnection- Throws:
IllegalStateException- If the handle is invalid.JMSException- Generic exception.
-
stop
public void stop() throws JMSExceptionForbidden call on an application or component's outbound connection, throws aIllegalStateExceptioninstance.- Specified by:
stopin interfaceConnection- Throws:
JMSException
-
createConnectionConsumer
public ConnectionConsumer createConnectionConsumer(Destination destination, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException
Forbidden call on an application or component's outbound connection, throws aIllegalStateExceptioninstance.- Specified by:
createConnectionConsumerin interfaceConnection- Throws:
JMSException
-
createDurableConnectionConsumer
public ConnectionConsumer createDurableConnectionConsumer(Topic topic, String subscriptionName, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException
Forbidden call on an application or component's outbound connection, throws aIllegalStateExceptioninstance.- Specified by:
createDurableConnectionConsumerin interfaceConnection- Throws:
JMSException
-
close
public void close() throws JMSExceptionRequests to close the physical connection.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceConnection- Specified by:
closein interfaceOutboundConnectionMBean- Throws:
IllegalStateException- If the handle is invalid.JMSException- Generic exception.
-
getNumberOfSession
public int getNumberOfSession()
- Specified by:
getNumberOfSessionin interfaceOutboundConnectionMBean
-
getSessions
public String[] getSessions()
- Specified by:
getSessionsin interfaceOutboundConnectionMBean
-
createSharedConnectionConsumer
public ConnectionConsumer createSharedConnectionConsumer(Topic topic, String subscriptionName, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException
- Specified by:
createSharedConnectionConsumerin interfaceConnection- Throws:
JMSException
-
createSharedDurableConnectionConsumer
public ConnectionConsumer createSharedDurableConnectionConsumer(Topic topic, String subscriptionName, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException
- Specified by:
createSharedDurableConnectionConsumerin interfaceConnection- Throws:
JMSException
-
getJMXBeanName
public String getJMXBeanName(XAConnection cnx)
-
registerMBean
public String registerMBean()
-
unregisterMBean
public void unregisterMBean()
-
-