org.huihoo.jfox.ms.jms.base
Class ConnectionImpl

java.lang.Object
  extended byorg.huihoo.jfox.ms.jms.base.ConnectionImpl
All Implemented Interfaces:
javax.jms.Connection
Direct Known Subclasses:
QueueConnectionImpl, TopicConnectionImpl

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

Description: This class implements javax.jms.Connection. The connection object is received from a connection factory.

Connections support concurrent use.

Version:
Revision: 1.1 Date: 2003-05-19 22:36:31
Author:
Peter.Cheng

Constructor Summary
ConnectionImpl(ConnectionFactoryImpl connFactory, java.lang.String userName, java.lang.String password)
           
 
Method Summary
protected  void addSession(SessionImpl session)
          Add the specified session to the list of managed sessions
 void close()
          Closes the connection.
 java.lang.String getClientID()
           
 javax.jms.ExceptionListener getExceptionListener()
           
 javax.jms.ConnectionMetaData getMetaData()
           
 boolean isClosed()
          Identify the connection state.
 boolean isStopped()
          Identify the connection state.
protected  void removeSession(SessionImpl session)
          Remove the specified session to the list of managed sessions
 void setClientID(java.lang.String clientID)
           
 void setExceptionListener(javax.jms.ExceptionListener listener)
           
 void start()
          Starts (or restarts) a connection's delivery of incoming messages.
 void stop()
          Stops the asynchronous deliveries in the session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionImpl

public ConnectionImpl(ConnectionFactoryImpl connFactory,
                      java.lang.String userName,
                      java.lang.String password)
Method Detail

getClientID

public java.lang.String getClientID()
                             throws javax.jms.JMSException
Specified by:
getClientID in interface javax.jms.Connection
Throws:
javax.jms.JMSException

setClientID

public void setClientID(java.lang.String clientID)
                 throws javax.jms.JMSException
Specified by:
setClientID in interface javax.jms.Connection
Throws:
javax.jms.JMSException

getMetaData

public javax.jms.ConnectionMetaData getMetaData()
                                         throws javax.jms.JMSException
Specified by:
getMetaData in interface javax.jms.Connection
Throws:
javax.jms.JMSException

getExceptionListener

public javax.jms.ExceptionListener getExceptionListener()
                                                 throws javax.jms.JMSException
Specified by:
getExceptionListener in interface javax.jms.Connection
Throws:
javax.jms.JMSException

setExceptionListener

public void setExceptionListener(javax.jms.ExceptionListener listener)
                          throws javax.jms.JMSException
Specified by:
setExceptionListener in interface javax.jms.Connection
Throws:
javax.jms.JMSException

start

public void start()
           throws javax.jms.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 javax.jms.Connection
Throws:
javax.jms.IllegalStateException - if the connection is closed.
javax.jms.JMSException - if the JMS provider fails to start message delivery due to some internal error.

stop

public void stop()
          throws javax.jms.JMSException
Stops the asynchronous deliveries in the session. 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 javax.jms.Connection
Throws:
javax.jms.IllegalStateException - if the connection is closed.
javax.jms.JMSException - if the JMS provider fails to start message delivery due to some internal error.

close

public void close()
           throws javax.jms.JMSException
Closes the connection.

Since a provider typically allocates significant resources outside the JVM on behalf of a connection, clients should close these resources when they are not needed. Relying on garbage collection to eventually reclaim these resources may not be timely enough.

Specified by:
close in interface javax.jms.Connection
Throws:
javax.jms.JMSException - if the JMS provider fails to start message delivery due to some internal error.

isClosed

public boolean isClosed()
Identify the connection state.

Returns:
boolean true the connection is closed

isStopped

public boolean isStopped()
Identify the connection state.

Returns:
boolean ture the connection is stopped

addSession

protected void addSession(SessionImpl session)
Add the specified session to the list of managed sessions

Parameters:
session - session to register

removeSession

protected void removeSession(SessionImpl session)
Remove the specified session to the list of managed sessions

Parameters:
session - session to deregister


Copyright © 2002-2003 Open Enterprise Foundation. All Rights Reserved.