All Packages Class Hierarchy This Package Previous Next Index
Class Abstract.ConnectionTable
Abstract.ConnectionTable
- public abstract class ConnectionTable
BaseLayer.Connection.ConnectionTable
A Table with key as an agent name and field value as a ReceiverThread.
It is always assumed that there's only one ReceiverThread for each
agent to comminicate with. If you want more than one connection for
the same agent, you should specify it with a different name.
When you add a ReceiverThread with the same name, the pre-existing
thread will be stop and new thread will be added to the table.
- See Also:
- ReceiverThread
-
ConnectionTable()
- Default constructor
-
addConnection(String, Thread, boolean)
- Add ReceiverThread to the table.
-
getConnection(String)
- Get Connection by agent name.
-
isLiving(String)
- Find out whether the receiver is alive
-
removeConnection(String)
- Remove ReceiverThread from the table
If the ReceiverThread associated with agent name does not exist, do nothing
ConnectionTable
public ConnectionTable()
- Default constructor
getConnection
public abstract ReceiverThread getConnection(String agentName)
- Get Connection by agent name. If the name is not exist, null will be returned
- Parameters:
- agentName - Agent name referenced as key
- Returns:
- ReceiverThread. 'null' if not exist
addConnection
public abstract synchronized void addConnection(String agentName,
Thread thread,
boolean override)
- Add ReceiverThread to the table.
If the same name ReceiverThread is exist, and the override is true,the ReceiverThread will be
stop and replaced by a new ReceiverThread
- Parameters:
- agentName - Agent name as a key
- ReceiverThread - ReceiverThread as a field
- override - Override current ReceiverThread with the same name if true
removeConnection
public abstract void removeConnection(String agentName)
- Remove ReceiverThread from the table
If the ReceiverThread associated with agent name does not exist, do nothing
- Parameters:
- agentName - Agent name to be referenced
isLiving
public abstract boolean isLiving(String name)
- Find out whether the receiver is alive
- Parameters:
- name - receiver thread name
All Packages Class Hierarchy This Package Previous Next Index