com.caucho.jms.connection
Class ConnectionImpl

java.lang.Object
  extended by com.caucho.jms.connection.ConnectionImpl
All Implemented Interfaces:
Connection, XAConnection
Direct Known Subclasses:
QueueConnectionImpl, TopicConnectionImpl

public class ConnectionImpl
extends java.lang.Object
implements XAConnection

A connection.


Constructor Summary
ConnectionImpl(ConnectionFactoryImpl factory)
           
ConnectionImpl(ConnectionFactoryImpl factory, boolean isXA)
           
 
Method Summary
protected  void addSession(JmsSession session)
          Adds a session.
protected  void assignClientID()
          Assigns a random client id.
protected  void checkOpen()
          Checks that the session is open.
 void close()
          Closes the connection.
 ConnectionConsumer createConnectionConsumer(Destination destination, java.lang.String messageSelector, ServerSessionPool sessionPool, int maxMessages)
          Creates a new consumer (optional)
 ConnectionConsumer createDurableConnectionConsumer(Topic topic, java.lang.String name, java.lang.String messageSelector, ServerSessionPool sessionPool, int maxMessages)
          Creates a new consumer (optional)
 Session createSession(boolean transacted, int acknowledgeMode)
          Creates a new connection session.
 XASession createXASession()
          Creates a new connection session.
 java.lang.String getClientID()
          Returns the connection's client identifier.
 ConnectionFactoryImpl getConnectionFactory()
          Returns the connection factory.
 ExceptionListener getExceptionListener()
          Returns the connection's exception listener.
 ConnectionMetaData getMetaData()
          Returns the connection's metadata.
 boolean isXA()
          Returns true for an XA connection.
 void setClientID(java.lang.String clientId)
          Sets the connections client identifier.
 void setExceptionListener(ExceptionListener listener)
          Returns the connection's exception listener.
 void start()
          Start (or restart) a connection.
 void stop()
          Stops the connection temporarily.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConnectionImpl

public ConnectionImpl(ConnectionFactoryImpl factory,
                      boolean isXA)

ConnectionImpl

public ConnectionImpl(ConnectionFactoryImpl factory)
Method Detail

isXA

public boolean isXA()
Returns true for an XA connection.


getClientID

public java.lang.String getClientID()
                             throws JMSException
Returns the connection's client identifier.

Specified by:
getClientID in interface Connection
Throws:
JMSException

setClientID

public void setClientID(java.lang.String clientId)
                 throws JMSException
Sets the connections client identifier.

Specified by:
setClientID in interface Connection
Parameters:
the - new client identifier.
Throws:
JMSException

getConnectionFactory

public ConnectionFactoryImpl getConnectionFactory()
Returns the connection factory.


getExceptionListener

public ExceptionListener getExceptionListener()
                                       throws JMSException
Returns the connection's exception listener.

Specified by:
getExceptionListener in interface Connection
Throws:
JMSException

setExceptionListener

public void setExceptionListener(ExceptionListener listener)
                          throws JMSException
Returns the connection's exception listener.

Specified by:
setExceptionListener in interface Connection
Throws:
JMSException

getMetaData

public ConnectionMetaData getMetaData()
                               throws JMSException
Returns the connection's metadata.

Specified by:
getMetaData in interface Connection
Throws:
JMSException

start

public void start()
           throws JMSException
Start (or restart) a connection.

Specified by:
start in interface Connection
Throws:
JMSException

stop

public void stop()
          throws JMSException
Stops the connection temporarily.

Specified by:
stop in interface Connection
Throws:
JMSException

createSession

public Session createSession(boolean transacted,
                             int acknowledgeMode)
                      throws JMSException
Creates a new connection session.

Specified by:
createSession in interface Connection
Specified by:
createSession in interface XAConnection
Throws:
JMSException

createXASession

public XASession createXASession()
                          throws JMSException
Creates a new connection session.

Specified by:
createXASession in interface XAConnection
Throws:
JMSException

addSession

protected void addSession(JmsSession session)
Adds a session.


createConnectionConsumer

public ConnectionConsumer createConnectionConsumer(Destination destination,
                                                   java.lang.String messageSelector,
                                                   ServerSessionPool sessionPool,
                                                   int maxMessages)
                                            throws JMSException
Creates a new consumer (optional)

Specified by:
createConnectionConsumer in interface Connection
Throws:
JMSException

createDurableConnectionConsumer

public ConnectionConsumer createDurableConnectionConsumer(Topic topic,
                                                          java.lang.String name,
                                                          java.lang.String messageSelector,
                                                          ServerSessionPool sessionPool,
                                                          int maxMessages)
                                                   throws JMSException
Creates a new consumer (optional)

Specified by:
createDurableConnectionConsumer in interface Connection
Throws:
JMSException

close

public void close()
           throws JMSException
Closes the connection.

Specified by:
close in interface Connection
Throws:
JMSException

checkOpen

protected void checkOpen()
                  throws IllegalStateException
Checks that the session is open.

Throws:
IllegalStateException

assignClientID

protected void assignClientID()
Assigns a random client id. XXX: possibly wrong, i.e. shouldn't assign, for durable subscriptions


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object