Public Member Functions | Static Public Member Functions | Package Attributes

cl.utfsm.samplingSystemUI.core.ThreadCommunicator Class Reference

List of all members.

Public Member Functions

LinkedBlockingQueue< DataItemcreateChannel (String cName)
LinkedBlockingQueue< DataItemgetChannel (String cName)
void removeChannel (String cName)

Static Public Member Functions

static synchronized
ThreadCommunicator 
getInstance ()

Package Attributes

Hashtable< String,
LinkedBlockingQueue< DataItem > > 
channels = null

Detailed Description

This is a manager class designed to transport information from one thread to an other. The comunication is based in channels, each channel has its own LinkedBlockingQueue to gurantee data consistency. Once you get a channel to eficiently extract the data the darinTo(Collection c) meber is prefered, as it will move the data from the queue to the colection in an atomic action.


Member Function Documentation

LinkedBlockingQueue<DataItem> cl.utfsm.samplingSystemUI.core.ThreadCommunicator.createChannel ( String  cName  ) 

Checks if a channel already exist, if it does, throws an Exception, else, adds a new Queue to the channel and assigns a name to it.

Parameters:
cName Name of the Channel to be created
Returns:
A new BlockingQueue with the given parametres as values

References cl.utfsm.samplingSystemUI.core.ThreadCommunicator.channels.

LinkedBlockingQueue<DataItem> cl.utfsm.samplingSystemUI.core.ThreadCommunicator.getChannel ( String  cName  ) 

Getter for a channel given it's name

Returns:
The found channel. (null if it doesn't exists)

References cl.utfsm.samplingSystemUI.core.ThreadCommunicator.channels.

static synchronized ThreadCommunicator cl.utfsm.samplingSystemUI.core.ThreadCommunicator.getInstance (  )  [static]

Constructor that mantains the singleton consistency for each Communicator.

Returns:
An instance of ThreadCommunicator
void cl.utfsm.samplingSystemUI.core.ThreadCommunicator.removeChannel ( String  cName  ) 

Removes a channel of the Queue.

Parameters:
cName Name of the channel to remove

References cl.utfsm.samplingSystemUI.core.ThreadCommunicator.channels.


Member Data Documentation

Hashtable<String,LinkedBlockingQueue<DataItem> > cl.utfsm.samplingSystemUI.core.ThreadCommunicator.channels = null [package]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties