
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 |
Private Member Functions | |
| ThreadCommunicator () | |
Static Private Attributes | |
| static ThreadCommunicator | _instance |
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.
| cl::utfsm::samplingSystemUI::core::ThreadCommunicator::ThreadCommunicator | ( | ) | [inline, private] |
| 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.
| cName | Name of the Channel to be created |
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
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.
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.
| cName | Name of the channel to remove |
References channels.
Referenced by cl::utfsm::samplingSystemUITestCase::ThreadCommunicatorTest::testDeletion().
ThreadCommunicator cl::utfsm::samplingSystemUI::core::ThreadCommunicator::_instance [static, private] |
Referenced by getInstance().
Hashtable<String,LinkedBlockingQueue<DataItem> > cl::utfsm::samplingSystemUI::core::ThreadCommunicator::channels = null [package] |
Referenced by createChannel(), getChannel(), removeChannel(), and ThreadCommunicator().
1.6.2