lime
Class ConnectionMgr

java.lang.Object
  extended bylime.ConnectionMgr

class ConnectionMgr
extends java.lang.Object

The ConnectionMgr manages "Connection" objects, which are TCP connections to remote hosts.

Author:
Amy Murphy, GP, Chien-Liang Fok

Nested Class Summary
(package private)  class ConnectionMgr.Connection
          Connection manages the TCP connection to a remote host.
 
Field Summary
(package private)  java.util.Hashtable connections
          Holds all of the connections managed by this class.
(package private)  boolean isConnect
          If true, then permanent connections are allowed.
 
Constructor Summary
(package private) ConnectionMgr(boolean isConnect)
          Creates a ConnectionMgr with the specified connection setting.
 
Method Summary
(package private)  ConnectionMgr.Connection add(java.net.Socket s)
          Adds a socket to be controlled by the Connection Manager.
(package private)  void close(ConnectionMgr.Connection connection)
          Closes the socket managed by the connection.
(package private)  void closeAll()
          Closes all of the connections created.
(package private)  ConnectionMgr.Connection get(LimeServerID lsID)
          Returns the eonnection to the LimeServer with the specified LimeServerID.
(package private)  boolean isPermanent()
          Returns whether connections established by this class are permanent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connections

java.util.Hashtable connections
Holds all of the connections managed by this class. The connectioned are keyed by the LimeServerID within the Connection class (e.g. Connection.key)


isConnect

boolean isConnect
If true, then permanent connections are allowed. If false, then connections are terminated immediately after being used.

Constructor Detail

ConnectionMgr

ConnectionMgr(boolean isConnect)
Creates a ConnectionMgr with the specified connection setting. If isConnect is true, then once a connection as been created, it remains created.

Parameters:
isConnect - true if the connection is a permanent connection.
Method Detail

isPermanent

boolean isPermanent()
Returns whether connections established by this class are permanent.

Returns:
true if connections established by this class are permanent.

get

ConnectionMgr.Connection get(LimeServerID lsID)
Returns the eonnection to the LimeServer with the specified LimeServerID.

Returns:
the eonnection to the LimeServer with the specified LimeServerID.

add

ConnectionMgr.Connection add(java.net.Socket s)
Adds a socket to be controlled by the Connection Manager. The socket is controlled by a "Connection" object that is created by this object.

Parameters:
s - the socket to be controlled by this connection manager.
Returns:
the "Connection" object that manages the socket.

close

void close(ConnectionMgr.Connection connection)
Closes the socket managed by the connection.


closeAll

void closeAll()
Closes all of the connections created.