Joram 5.3.1

org.objectweb.joram.client.jms
Class Connection

java.lang.Object
  extended by org.objectweb.joram.client.jms.Connection
All Implemented Interfaces:
javax.jms.Connection
Direct Known Subclasses:
QueueConnection, TopicConnection, XAConnection

public class Connection
extends java.lang.Object
implements javax.jms.Connection

Implements the javax.jms.Connection interface.

A Connection object allows the client's active connection to the Joram server. Connections support concurrent use, it serves several purposes:

A Joram client typically creates a connection, one or more sessions, and a number of message producers and consumers.
When a connection is created, it is in stopped mode that means that no messages are being delivered. In order to minimize any client confusion that may result from asynchronous message delivery during setup, it is typical to leave the connection in stopped mode until setup is complete. A message producer can send messages while a connection is stopped.


Field Summary
static org.objectweb.util.monolog.api.Logger logger
           
 
Constructor Summary
Connection(FactoryParameters factoryParameters, RequestChannel requestChannel)
          Creates a Connection instance.
 
Method Summary
protected  void addSession(Session session)
          Called here and by sub-classes.
protected  void checkClosed()
          Checks if the connection is closed.
 void cleanup()
          Used by OutboundConnection in the connector layer.
 void close()
          API method for closing the connection; even if the connection appears to be broken, closes the sessions.
 javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Destination dest, java.lang.String selector, javax.jms.ServerSessionPool sessionPool, int maxMessages)
          API method.
 javax.jms.ConnectionConsumer createDurableConnectionConsumer(javax.jms.Topic topic, java.lang.String subName, java.lang.String selector, javax.jms.ServerSessionPool sessPool, int maxMessages)
          API method.
 javax.jms.Session createSession(boolean transacted, int acknowledgeMode)
          API method.
 boolean equals(java.lang.Object obj)
          Returns true if the parameter is a Connection instance sharing the same proxy identifier and connection key.
 boolean getAsyncSend()
          Indicates whether the messages produced are asynchronously sent or not (without or with acknowledgement).
 java.lang.String getClientID()
          API method.
 javax.jms.ExceptionListener getExceptionListener()
          API method.
 boolean getImplicitAck()
          Indicates whether the messages consumed are implicitly acknowledged or not.
 java.util.List getInInterceptors()
          returns the list of IN message interceptors.
 javax.jms.ConnectionMetaData getMetaData()
          API method.
 java.util.List getOutInterceptors()
          returns the list of OUT message interceptors.
 java.lang.String getOutLocalAddress()
          Returns the local IP address on which the TCP connection is activated.
 int getOutLocalPort()
          Returns the local IP address port on which the TCP connection is activated This attribute is inherited from FactoryParameters.
 int getQueueMessageReadMax()
          Get the maximum number of messages that can be read at once from a queue for this Connection.
protected  RequestMultiplexer getRequestMultiplexer()
           
 int getTopicAckBufferMax()
          Get the maximum number of acknowledgements that can be buffered when using Session.DUPS_OK_ACKNOWLEDGE mode for this Connection.
 int getTopicActivationThreshold()
          Get the threshold of activation for this Connection.
 int getTopicPassivationThreshold()
          Get the threshold of passivation for this Connection.
 long getTxPendingTimer()
          Returns the duration in seconds during which a JMS transacted (non XA) session might be pending; above that duration the session is rolled back and closed; the 0 value means "no timer".
 int hashCode()
           
 void setClientID(java.lang.String clientID)
          API method.
 void setExceptionListener(javax.jms.ExceptionListener listener)
          API method.
 void start()
          API method for starting the connection.
 void stop()
          API method for stopping the connection; even if the connection appears to be broken, stops the sessions.
 java.lang.String toString()
          String image of the connection.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

public static org.objectweb.util.monolog.api.Logger logger
Constructor Detail

Connection

public Connection(FactoryParameters factoryParameters,
                  RequestChannel requestChannel)
           throws javax.jms.JMSException
Creates a Connection instance.

Parameters:
factoryParameters - The factory parameters.
requestChannel - The actual connection to wrap.
Throws:
javax.jms.JMSSecurityException - If the user identification is incorrect.
javax.jms.IllegalStateException - If the server is not listening.
javax.jms.JMSException
Method Detail

toString

public java.lang.String toString()
String image of the connection.

Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Returns true if the parameter is a Connection instance sharing the same proxy identifier and connection key.

Overrides:
equals in class java.lang.Object

getTxPendingTimer

public final long getTxPendingTimer()
Returns the duration in seconds during which a JMS transacted (non XA) session might be pending; above that duration the session is rolled back and closed; the 0 value means "no timer".

Returns:
the duration in seconds during which a JMS transacted (non XA) session might be pending.
See Also:
FactoryParameters.txPendingTimer

getImplicitAck

public final boolean getImplicitAck()
Indicates whether the messages consumed are implicitly acknowledged or not. If true messages are immediately removed from queue when delivered and there is none acknowledge message from client to server.

This attribute is inherited from FactoryParameters, by default false.

Returns:
true if messages produced are implicitly acknowledged.
See Also:
FactoryParameters.implicitAck, Session.isImplicitAck()

getAsyncSend

public final boolean getAsyncSend()
Indicates whether the messages produced are asynchronously sent or not (without or with acknowledgement).

This attribute is inherited from FactoryParameters, by default false.

Returns:
true if messages produced are asynchronously sent.
See Also:
FactoryParameters.asyncSend, Session.isAsyncSend()

getQueueMessageReadMax

public final int getQueueMessageReadMax()
Get the maximum number of messages that can be read at once from a queue for this Connection.

This attribute is inherited from FactoryParameters, default value is 1.

Returns:
The maximum number of messages that can be read at once from a queue.
See Also:
FactoryParameters.queueMessageReadMax, Session.getQueueMessageReadMax()

getTopicAckBufferMax

public final int getTopicAckBufferMax()
Get the maximum number of acknowledgements that can be buffered when using Session.DUPS_OK_ACKNOWLEDGE mode for this Connection.

This attribute is inherited from FactoryParameters, default value is 0.

Returns:
The Maximum number of acknowledgements that can be buffered when using Session.DUPS_OK_ACKNOWLEDGE mode.
See Also:
FactoryParameters.topicAckBufferMax, Session.getTopicAckBufferMax()

getTopicPassivationThreshold

public final int getTopicPassivationThreshold()
Get the threshold of passivation for this Connection.

This threshold is the maximum messages number over which the subscription is passivated.

This attribute is inherited from FactoryParameters, default value is Integer.MAX_VALUE.

Returns:
The maximum messages number over which the subscription is passivated.
See Also:
FactoryParameters.topicPassivationThreshold, Session.getTopicPassivationThreshold()

getTopicActivationThreshold

public final int getTopicActivationThreshold()
Get the threshold of activation for this Connection.

This threshold is the minimum messages number below which the subscription is activated.

This attribute is inherited from FactoryParameters, default value is 0.

Returns:
The minimum messages number below which the subscription is activated.
See Also:
FactoryParameters.topicActivationThreshold, Session.getTopicActivationThreshold()

getOutLocalAddress

public final java.lang.String getOutLocalAddress()
Returns the local IP address on which the TCP connection is activated.

This attribute is inherited from FactoryParameters.

Returns:
the local IP address on which the TCP connection is activated.
See Also:
FactoryParameters.outLocalAddress

getOutLocalPort

public final int getOutLocalPort()
Returns the local IP address port on which the TCP connection is activated

This attribute is inherited from FactoryParameters.

Returns:
the local IP address port on which the TCP connection is activated.
See Also:
FactoryParameters.outLocalPort

getInInterceptors

public final java.util.List getInInterceptors()
returns the list of IN message interceptors.
Each IN message interceptor is called when receiving a message.
The execution follows the order of the elements within the list.

Returns:
the list of the IN message interceptors.

getOutInterceptors

public final java.util.List getOutInterceptors()
returns the list of OUT message interceptors.
Each OUT message interceptor is called when sending a message.
The execution follows the order of the elements within the list.

Returns:
the list of the OUT message interceptors.

checkClosed

protected final void checkClosed()
                          throws javax.jms.IllegalStateException
Checks if the connection is closed. If true raises an IllegalStateException.

Throws:
javax.jms.IllegalStateException

createConnectionConsumer

public javax.jms.ConnectionConsumer createConnectionConsumer(javax.jms.Destination dest,
                                                             java.lang.String selector,
                                                             javax.jms.ServerSessionPool sessionPool,
                                                             int maxMessages)
                                                      throws javax.jms.JMSException
API method.

Specified by:
createConnectionConsumer in interface javax.jms.Connection
Throws:
javax.jms.IllegalStateException - If the connection is closed.
javax.jms.InvalidSelectorException - If the selector syntax is wrong.
javax.jms.InvalidDestinationException - If the target destination does not exist.
javax.jms.JMSException - If the method fails for any other reason.

createDurableConnectionConsumer

public javax.jms.ConnectionConsumer createDurableConnectionConsumer(javax.jms.Topic topic,
                                                                    java.lang.String subName,
                                                                    java.lang.String selector,
                                                                    javax.jms.ServerSessionPool sessPool,
                                                                    int maxMessages)
                                                             throws javax.jms.JMSException
API method.

Specified by:
createDurableConnectionConsumer in interface javax.jms.Connection
Throws:
javax.jms.IllegalStateException - If the connection is closed.
javax.jms.InvalidSelectorException - If the selector syntax is wrong.
javax.jms.InvalidDestinationException - If the target topic does not exist.
javax.jms.JMSException - If the method fails for any other reason.

createSession

public javax.jms.Session createSession(boolean transacted,
                                       int acknowledgeMode)
                                throws javax.jms.JMSException
API method.

Specified by:
createSession in interface javax.jms.Connection
Throws:
javax.jms.IllegalStateException - If the connection is closed.
javax.jms.JMSException - In case of an invalid acknowledge mode.

addSession

protected void addSession(Session session)
Called here and by sub-classes.


setExceptionListener

public void setExceptionListener(javax.jms.ExceptionListener listener)
                          throws javax.jms.JMSException
API method.

Specified by:
setExceptionListener in interface javax.jms.Connection
Throws:
javax.jms.IllegalStateException - If the connection is closed.
javax.jms.JMSException

getExceptionListener

public javax.jms.ExceptionListener getExceptionListener()
                                                 throws javax.jms.JMSException
API method.

Specified by:
getExceptionListener in interface javax.jms.Connection
Throws:
javax.jms.IllegalStateException - If the connection is closed.
javax.jms.JMSException

setClientID

public void setClientID(java.lang.String clientID)
                 throws javax.jms.JMSException
API method.

Specified by:
setClientID in interface javax.jms.Connection
Throws:
javax.jms.IllegalStateException - Systematically thrown.
javax.jms.JMSException

getClientID

public java.lang.String getClientID()
                             throws javax.jms.JMSException
API method.

Specified by:
getClientID in interface javax.jms.Connection
Throws:
javax.jms.IllegalStateException - If the connection is closed.
javax.jms.JMSException

getMetaData

public javax.jms.ConnectionMetaData getMetaData()
                                         throws javax.jms.JMSException
API method.

Specified by:
getMetaData in interface javax.jms.Connection
Throws:
javax.jms.IllegalStateException - If the connection is closed.
javax.jms.JMSException

start

public void start()
           throws javax.jms.JMSException
API method for starting the connection.

Specified by:
start in interface javax.jms.Connection
Throws:
javax.jms.IllegalStateException - If the connection is closed or broken.
javax.jms.JMSException

stop

public void stop()
          throws javax.jms.JMSException
API method for stopping the connection; even if the connection appears to be broken, stops the sessions.

Specified by:
stop in interface javax.jms.Connection
Throws:
javax.jms.IllegalStateException - If the connection is closed or broken.
javax.jms.JMSException

close

public void close()
           throws javax.jms.JMSException
API method for closing the connection; even if the connection appears to be broken, closes the sessions.

Specified by:
close in interface javax.jms.Connection
Throws:
javax.jms.JMSException - Actually never thrown.

cleanup

public void cleanup()
Used by OutboundConnection in the connector layer. When a connection is put back in a pool, it must be cleaned up.


getRequestMultiplexer

protected final RequestMultiplexer getRequestMultiplexer()

Joram 5.3.1

Copyright © 2000 - 2009 Scalagent D.T. - All rights reserved