org.exolab.jms.server.rmi
Class RmiJmsServerConnection

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--org.exolab.jms.server.rmi.RmiJmsServerConnection
All Implemented Interfaces:
LeaseEventListenerIfc, java.rmi.Remote, RemoteJmsServerConnectionIfc, java.io.Serializable

public class RmiJmsServerConnection
extends java.rmi.server.UnicastRemoteObject
implements RemoteJmsServerConnectionIfc, LeaseEventListenerIfc

This is an implementation of the RemoteJmsServerConnectionIfc interface which wraps the JmsConnection class. It basically delegates to an instance of JmsConnection.

Version:
$Revision: 1.18 $ $Date: 2003/08/17 01:32:26 $
Author:
Jim Alateras
See Also:
JmsServerConnection, Serialized Form

Field Summary
protected  JmsServerConnection _delegate
          This is the object that the RMI connection object delegates to.
protected  int _interval
          The interval, in milliseconds, between subsequent ping events
protected  BaseLease _lease
          This is the lease on this object.
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
RmiJmsServerConnection(JmsServerConnection connection, int interval)
          Instantiae an instance of this class with a JmsServerConnection instance.
 
Method Summary
 void close()
          Close all the sessions allocated to this collection.
 RemoteJmsServerSessionIfc createSession(int ackMode, boolean transacted)
          Create and return a sesion for this connection Assign the connection's clientId to the sessions.
 void deleteSession(RemoteJmsServerSessionIfc session)
          Delete the specified session from the server.
 java.lang.String getConnectionId()
          Retrieve the identity of this conection.
 int getSessionCount()
          Return the number of session objects currently allocated to this connection.
 java.util.Enumeration getSessions()
          Return an enumeration of RemoteJmsServerSessionIfc objects currently allocated to this session.
 void onLeaseExpired(java.lang.Object leasedObject)
          This method is called whenever a lease expires.
 void ping()
          Send a ping to the server.
 void start()
          Start all the sessions allocated to this connection.
 void stop()
          Stop all the sessions allocated to this collection.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_delegate

protected JmsServerConnection _delegate
This is the object that the RMI connection object delegates to. It must be non-null and assigned during object construction

_interval

protected int _interval
The interval, in milliseconds, between subsequent ping events

_lease

protected BaseLease _lease
This is the lease on this object. This is not used anymore since we now use a different approach to determine whether the client is active. {@see JmsServerSession#isClientEndpointActive}
Constructor Detail

RmiJmsServerConnection

public RmiJmsServerConnection(JmsServerConnection connection,
                              int interval)
                       throws java.rmi.RemoteException
Instantiae an instance of this class with a JmsServerConnection instance. This class will simply delegate requests to the JmsServerConnection object. If a null connection is specified then throw JMSException.
Parameters:
connection - delegate connection object
interval - the interval between ping requests, in seconds
Throws:
java.rmi.RemoteException - if failed to export object
Method Detail

createSession

public RemoteJmsServerSessionIfc createSession(int ackMode,
                                               boolean transacted)
                                        throws javax.jms.JMSException,
                                               java.rmi.RemoteException
Description copied from interface: RemoteJmsServerConnectionIfc
Create and return a sesion for this connection Assign the connection's clientId to the sessions.

The created session represents an endpoint with the JmsServer where you can create consumers, producers and destinations. If there is an error creating the session then RemoteException is thrown

Specified by:
createSession in interface RemoteJmsServerConnectionIfc
Following copied from interface: org.exolab.jms.server.rmi.RemoteJmsServerConnectionIfc
Parameters:
ackMode - the ack mode for the session
Returns:
JmsSession created session
Throws:
javax.jms.JMSException -  
java.rmi.RemoteException -  

deleteSession

public void deleteSession(RemoteJmsServerSessionIfc session)
                   throws javax.jms.JMSException,
                          java.rmi.RemoteException
Description copied from interface: RemoteJmsServerConnectionIfc
Delete the specified session from the server. This will destroy all associated consumers and producers.

If there is a problem completing this request then throw RemoteException exception

Specified by:
deleteSession in interface RemoteJmsServerConnectionIfc
Following copied from interface: org.exolab.jms.server.rmi.RemoteJmsServerConnectionIfc
Parameters:
session - session to delete
Throws:
javax.jms.JMSException -  
java.rmi.RemoteException -  

getSessionCount

public int getSessionCount()
                    throws javax.jms.JMSException,
                           java.rmi.RemoteException
Description copied from interface: RemoteJmsServerConnectionIfc
Return the number of session objects currently allocated to this connection.

If there is a problem completing this request then throw RemoteException exception

Specified by:
getSessionCount in interface RemoteJmsServerConnectionIfc
Following copied from interface: org.exolab.jms.server.rmi.RemoteJmsServerConnectionIfc
Returns:
int
Throws:
javax.jms.JMSException -  
java.rmi.RemoteException -  

getSessions

public java.util.Enumeration getSessions()
                                  throws javax.jms.JMSException,
                                         java.rmi.RemoteException
Description copied from interface: RemoteJmsServerConnectionIfc
Return an enumeration of RemoteJmsServerSessionIfc objects currently allocated to this session.

If there is a problem completing this request then throw RemoteException exception

Specified by:
getSessions in interface RemoteJmsServerConnectionIfc
Following copied from interface: org.exolab.jms.server.rmi.RemoteJmsServerConnectionIfc
Returns:
Enumeration
Throws:
javax.jms.JMSException -  
java.rmi.RemoteException -  

start

public void start()
           throws javax.jms.JMSException,
                  java.rmi.RemoteException
Description copied from interface: RemoteJmsServerConnectionIfc
Start all the sessions allocated to this connection.

If there is a problem completing this request then throw RemoteException exception

Specified by:
start in interface RemoteJmsServerConnectionIfc
Following copied from interface: org.exolab.jms.server.rmi.RemoteJmsServerConnectionIfc
Throws:
javax.jms.JMSException -  
java.rmi.RemoteException -  

stop

public void stop()
          throws javax.jms.JMSException,
                 java.rmi.RemoteException
Description copied from interface: RemoteJmsServerConnectionIfc
Stop all the sessions allocated to this collection. Do not reemove the session

If there is a problem completing this request then throw RemoteException exception

Specified by:
stop in interface RemoteJmsServerConnectionIfc
Following copied from interface: org.exolab.jms.server.rmi.RemoteJmsServerConnectionIfc
Throws:
javax.jms.JMSException -  
java.rmi.RemoteException -  

close

public void close()
           throws javax.jms.JMSException,
                  java.rmi.RemoteException
Description copied from interface: RemoteJmsServerConnectionIfc
Close all the sessions allocated to this collection. This will also remove the session from the allocated list of sessions

If there is a problem completing this request then throw RemoteException exception

Specified by:
close in interface RemoteJmsServerConnectionIfc
Following copied from interface: org.exolab.jms.server.rmi.RemoteJmsServerConnectionIfc
Throws:
javax.jms.JMSException -  
java.rmi.RemoteException -  

getConnectionId

public java.lang.String getConnectionId()
                                 throws java.rmi.RemoteException
Description copied from interface: RemoteJmsServerConnectionIfc
Retrieve the identity of this conection.
Specified by:
getConnectionId in interface RemoteJmsServerConnectionIfc
Following copied from interface: org.exolab.jms.server.rmi.RemoteJmsServerConnectionIfc
Returns:
String
Throws:
java.rmi.RemoteException -  

ping

public void ping()
          throws java.rmi.RemoteException
Description copied from interface: RemoteJmsServerConnectionIfc
Send a ping to the server.
Specified by:
ping in interface RemoteJmsServerConnectionIfc
Following copied from interface: org.exolab.jms.server.rmi.RemoteJmsServerConnectionIfc
Throws:
java.rmi.RemoteException -  

onLeaseExpired

public void onLeaseExpired(java.lang.Object leasedObject)
Description copied from interface: LeaseEventListenerIfc
This method is called whenever a lease expires. It passes the object that has expired.
Specified by:
onLeaseExpired in interface LeaseEventListenerIfc
Following copied from interface: org.exolab.jms.lease.LeaseEventListenerIfc
Parameters:
leasedObject - reference to the leased object


Copyright © 1999-2004 The OpenJMS Group. All Rights Reserved.