diff options
Diffstat (limited to 'TAO/examples/Simulator/DOVEBrowser/MTDataHandlerAdapter.java')
-rw-r--r-- | TAO/examples/Simulator/DOVEBrowser/MTDataHandlerAdapter.java | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/TAO/examples/Simulator/DOVEBrowser/MTDataHandlerAdapter.java b/TAO/examples/Simulator/DOVEBrowser/MTDataHandlerAdapter.java deleted file mode 100644 index 5025c0a8e6d..00000000000 --- a/TAO/examples/Simulator/DOVEBrowser/MTDataHandlerAdapter.java +++ /dev/null @@ -1,76 +0,0 @@ -// $Id$ - -// This is an adapter class for a data handler to be used in a separate -// thread. The adapter provides a push method that places an event -// set into its synchronized internal MTQueue. It runs a separate thread -// which blocks until there is an event in the queue, then dequeues the -// event and then unpacks it and updates the underlying data handler. - -public class MTDataHandlerAdapter extends Thread -{ - // Both the queue and the underlying data handler are private - private MTQueue queue_ = null; - private DataHandler dataHandler_ = null; - private boolean use_queueing_ = false; - - // Constructor. - MTDataHandlerAdapter (DataHandler dh, boolean use_queueing) - { - dataHandler_ = dh; - use_queueing_ = use_queueing; - if (use_queueing_) - { - queue_ = new MTQueue (); - } - } - - // Enqueue an event set for the handler thread. - public void push (RtecEventComm.Event[] events) - { - if (use_queueing_) - { - queue_.enqueue_tail (events); - } - else - { - for (int i = 0; i < events.length; ++i) - { - if(events[i].header.type == - PushConsumer.ACE_ES_EVENT_NOTIFICATION) - { - dataHandler_.update (events[i]); - } - } - } - } - - // Process enqueued event sets in a separate thread. - public void run () - { - // Loop forever, handling events. - for (;;) - { - try - { - // Pull an event set from the head of the queue - RtecEventComm.Event[] events = - (RtecEventComm.Event[]) queue_.dequeue_head (); - - for (int i = 0; i < events.length; ++i) - { - if(events[i].header.type == - PushConsumer.ACE_ES_EVENT_NOTIFICATION) - { - dataHandler_.update (events[i]); - } - } - } - catch(org.omg.CORBA.SystemException e) - { - System.err.println(e); - } - } - } -} - - |