All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class BaseLayer.BConnectionTable

Abstract.ConnectionTable
   |
   +----BaseLayer.BConnectionTable

public class BConnectionTable
extends ConnectionTable
Implementation of Abstract.ConnectionTable A Table with key as an agent name and field value as a ReceiverThread This always assume 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

Constructor Index

 o BConnectionTable()
Default constructor

Method Index

 o addConnection(String, Thread, boolean)
Add ReceiverThread to the table If the same name ReceiverThread is exist, and override is true,the ReceiverThread will be stop and replaced by a new ReceiverThread
 o getConnection(String)
Get Connection by agent name.
 o isLiving(String)
Check if the ReceiverThread is alive.
 o removeConnection(String)
Remove ReceiverThread from the table If the ReceiverThread associated with agent name does not exist, do nothing

Constructors

 o BConnectionTable
 public BConnectionTable()
Default constructor

Methods

 o getConnection
 public 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
 o addConnection
 public synchronized void addConnection(String agentName,
                                        Thread thread,
                                        boolean override)
Add ReceiverThread to the table If the same name ReceiverThread is exist, and 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 value
override - Override current ReceiverThread with same name if true.
 o removeConnection
 public 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
 o isLiving
 public boolean isLiving(String id)
Check if the ReceiverThread is alive. Return true if alive.

Parameters:
id - Agent name

All Packages  Class Hierarchy  This Package  Previous  Next  Index