cgl.narada.jms
Class JmsConnection

java.lang.Object
  extended by cgl.narada.jms.JmsConnection
All Implemented Interfaces:
Connection
Direct Known Subclasses:
JmsTopicConnection

public class JmsConnection
extends Object
implements Connection

This class implements the JMS connection.


Constructor Summary
JmsConnection()
           
 
Method Summary
 void addToListOfManagedSessions(JmsSession session)
           
 void close()
          Closes the connection.
 String getClientID()
          Gets the client identifier for this connection.
 ExceptionListener getExceptionListener()
          Gets the ExceptionListener object for this connection.
 ConnectionMetaData getMetaData()
          Gets the metadata for this connection.
 void notifyExceptionListener(JMSException exception)
          If there is a registered exception listener, this method notifies the exception listener if there are any exceptions that take place.
 void setClientID(String clientID)
          Sets the client identifier for this connection.
 void setExceptionListener(ExceptionListener listener)
          Sets an exception listener for this connection.
 void start()
          Starts (or restarts) a connection's delivery of incoming messages.
 void stop()
          Temporarily stops a connection's delivery of incoming messages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JmsConnection

public JmsConnection()
Method Detail

getClientID

public String getClientID()
                   throws JMSException
Gets the client identifier for this connection.

Specified by:
getClientID in interface Connection
Returns:
the unique client identifier
Throws:
JMSException - if the JMS provider fails to return the client ID for this connection due to some internal error.

setClientID

public void setClientID(String clientID)
                 throws JMSException
Sets the client identifier for this connection.

Specified by:
setClientID in interface Connection
Parameters:
clientID - the unique client identifier
Throws:
JMSException - if the JMS provider fails to set the client ID for this connection due to some internal error.
InvalidClientIDException - if the JMS client specifies an invalid or duplicate client ID.
IllegalStateException - if the JMS client attempts to set a connection's client ID at the wrong time or when it has been administratively configured.

getMetaData

public ConnectionMetaData getMetaData()
                               throws JMSException
Gets the metadata for this connection.

Specified by:
getMetaData in interface Connection
Returns:
the connection metadata
Throws:
JMSException - if the JMS provider fails to get the connection metadata for this connection.
See Also:
ConnectionMetaData

getExceptionListener

public ExceptionListener getExceptionListener()
                                       throws JMSException
Gets the ExceptionListener object for this connection.

Specified by:
getExceptionListener in interface Connection
Returns:
the ExceptionListener for this connection
Throws:
JMSException - if the JMS provider fails to get the ExceptionListener for this connection.

setExceptionListener

public void setExceptionListener(ExceptionListener listener)
                          throws JMSException
Sets an exception listener for this connection.

Specified by:
setExceptionListener in interface Connection
Parameters:
listener - the exception listener
Throws:
JMSException - if the JMS provider fails to set the exception listener for this connection.

notifyExceptionListener

public void notifyExceptionListener(JMSException exception)
If there is a registered exception listener, this method notifies the exception listener if there are any exceptions that take place. If the listener is null the exception is simply ignored

Parameters:
exception - The exception that has occured.

start

public void start()
           throws JMSException
Starts (or restarts) a connection's delivery of incoming messages. A call to start on a connection that has already been started is ignored.

Specified by:
start in interface Connection
Throws:
JMSException - if the JMS provider fails to start message delivery due to some internal error.
See Also:
Connection.stop()

stop

public void stop()
          throws JMSException
Temporarily stops a connection's delivery of incoming messages. Delivery can be restarted using the connection's start method. When the connection is stopped, delivery to all the connection's message consumers is inhibited: synchronous receives block, and messages are not delivered to message listeners.

Specified by:
stop in interface Connection
Throws:
JMSException - if the JMS provider fails to stop message delivery due to some internal error.
See Also:
Connection.start()

close

public void close()
           throws JMSException
Closes the connection.

Specified by:
close in interface Connection
Throws:
JMSException - if the JMS provider fails to close the connection due to some internal error. For example, a failure to release resources or to close a socket connection can cause this exception to be thrown.

addToListOfManagedSessions

public void addToListOfManagedSessions(JmsSession session)


For comments and suggestions please send e-mail to The NaradaBrokering Project