Public Member Functions | |
LinkedBlockingQueue< DataItem > | createChannel (String cName) |
LinkedBlockingQueue< DataItem > | getChannel (String cName) |
void | removeChannel (String cName) |
Static Public Member Functions | |
static synchronized ThreadCommunicator | getInstance () |
Package Attributes | |
Hashtable< String, LinkedBlockingQueue< DataItem > > | channels = null |
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.
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.
cName | Name of the Channel to be created |
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
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.
void cl.utfsm.samplingSystemUI.core.ThreadCommunicator.removeChannel | ( | String | cName | ) |
Removes a channel of the Queue.
cName | Name of the channel to remove |
References cl.utfsm.samplingSystemUI.core.ThreadCommunicator.channels.
Hashtable<String,LinkedBlockingQueue<DataItem> > cl.utfsm.samplingSystemUI.core.ThreadCommunicator.channels = null [package] |