cl::utfsm::samplingSystemUI::core::ThreadCommunicator Class Reference

Collaboration diagram for cl::utfsm::samplingSystemUI::core::ThreadCommunicator:
Collaboration graph
[legend]

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

Private Member Functions

 ThreadCommunicator ()

Static Private Attributes

static ThreadCommunicator _instance

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.


Constructor & Destructor Documentation

cl::utfsm::samplingSystemUI::core::ThreadCommunicator::ThreadCommunicator (  )  [inline, private]

Constructs a new HashTable for the Communicator

References channels.

Referenced by getInstance().


Member Function Documentation

LinkedBlockingQueue<DataItem> cl::utfsm::samplingSystemUI::core::ThreadCommunicator::createChannel ( String  cName  )  [inline]

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 channels.

Referenced by cl::utfsm::samplingSystemUITestCase::ThreadCommunicatorTest::testConsistency(), and cl::utfsm::samplingSystemUITestCase::ThreadCommunicatorTest::testDeletion().

LinkedBlockingQueue<DataItem> cl::utfsm::samplingSystemUI::core::ThreadCommunicator::getChannel ( String  cName  )  [inline]

Getter for a channel given it's name

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

References channels.

Referenced by cl::utfsm::samplingSystemUITestCase::ThreadCommunicatorTest::testConsistency(), and cl::utfsm::samplingSystemUITestCase::ThreadCommunicatorTest::testDeletion().

static synchronized ThreadCommunicator cl::utfsm::samplingSystemUI::core::ThreadCommunicator::getInstance (  )  [inline, static]

Constructor that mantains the singleton consistency for each Communicator.

Returns:
An instance of ThreadCommunicator

References _instance, and ThreadCommunicator().

Referenced by cl::utfsm::samplingSystemUITestCase::ThreadCommunicatorTest::testSingleton().

void cl::utfsm::samplingSystemUI::core::ThreadCommunicator::removeChannel ( String  cName  )  [inline]

Removes a channel of the Queue.

Parameters:
cName Name of the channel to remove

References channels.

Referenced by cl::utfsm::samplingSystemUITestCase::ThreadCommunicatorTest::testDeletion().


Member Data Documentation

Referenced by getInstance().

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

The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2