All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class COM.meitca.concordia.event.EventQueueImpl


java.lang.Object

   |

   +----java.rmi.server.RemoteObject

           |

           +----java.rmi.server.RemoteServer

                   |

                   +----java.rmi.server.UnicastRemoteObject

                           |

                           +----COM.meitca.concordia.event.EventNotifyImpl

                                   |

                                   +----COM.meitca.concordia.event.EventQueueImpl


public class EventQueueImpl
extends EventNotifyImpl
implements EventPost
EventQueueImpl is an asynchronous implementation of event notification. This class should only be used by non-mobile objects. Agents should use the Agent's makeEventHandler method, with an argument of false.

It implements the EventPost interface via an event queue. The queue has an associated thread started by the constructor. Event notification is performed by appending an event to the queue. Periodically, the queue's thread dequeues events and invokes the event handler.

The class EventNotifyImpl should be used if synchronous event notification is required.

See Also:
EventHandler, EventPost, EventNotifyImpl

Constructor Index

 o EventQueueImpl(EventHandler)
Constructs an EventQueueImpl.
 o EventQueueImpl(EventHandler, long)
Constructs an EventQueueImpl

Method Index

 o dequeue()
Dequeues an event.
 o enqueue(EventType)
Enqueues an event.
 o flush()
Flushes the event queue.
 o postEvent(MobileClassWrapper)
An implementation of the EventPost postEvent() method that asynchronously handles the event by enqueueing it and waking up the queue's thread.
 o postEvents(Vector)
An implementation of the EventPost postEvents() method that asynchronously handles the events by enqueueing them and waking up the queue's thread.
 o shutdown()
Shuts down the event queue, making it unusable.

Constructors

 o EventQueueImpl

 public EventQueueImpl(EventHandler handler) throws RemoteException

Constructs an EventQueueImpl.

Parameters:
handler - The associated event handler interface. This interface is typically implemented by the caller, which then passes the this reference.
 o EventQueueImpl

 public EventQueueImpl(EventHandler handler,

                       long timeout) throws RemoteException

Constructs an EventQueueImpl

Parameters:
handler - The associated event handler interface. This interface is typically implemented by the caller, which then passes the this reference.

timeout - The time in ms to wait between consecutive queue examinations.

Methods

 o postEvent

 public synchronized void postEvent(MobileClassWrapper eventWrapper) throws EventException

An implementation of the EventPost postEvent() method that asynchronously handles the event by enqueueing it and waking up the queue's thread.

Parameters:
eventWrapper - A wrapper for the event to send.
Throws: EventException
If an error occurs posting the event.
Overrides:
postEvent in class EventNotifyImpl
 o postEvents

 public synchronized void postEvents(Vector events) throws EventException, IOException

An implementation of the EventPost postEvents() method that asynchronously handles the events by enqueueing them and waking up the queue's thread.

Parameters:
events - A Vector containing the events to post.
Throws: RemoteException
If an error occurrs setting up network connections.
Throws: EventException
If an error occurs posting the event.
Overrides:
postEvents in class EventNotifyImpl
 o enqueue

 protected final synchronized void enqueue(EventType event)

Enqueues an event.

Parameters:
event - The event to queue.
 o dequeue

 protected final synchronized EventType dequeue() throws ArrayIndexOutOfBoundsException

Dequeues an event.

Returns:
The first event in the queue.
 o flush

 public final void flush()

Flushes the event queue.

 o shutdown

 public final synchronized void shutdown()

Shuts down the event queue, making it unusable.

Overrides:
shutdown in class EventNotifyImpl


All Packages  Class Hierarchy  This Package  Previous  Next  Index