EchoPoint
1.0

echopoint.asynch
Class AsynchEventQueue

java.lang.Object
  extended byechopoint.asynch.AsynchEventQueue
All Implemented Interfaces:
AsynchEventSink, java.io.Serializable

public class AsynchEventQueue
extends java.lang.Object
implements AsynchEventSink, java.io.Serializable

AysnchEventQueue is a class that can hold AsyncEvents in a queue'ed fashion.

See Also:
Serialized Form

Constructor Summary
AsynchEventQueue()
          Constructs a AysnchEventQueue with a capacity of 20 events.
AsynchEventQueue(int capacity)
          Constructs a AysnchEventQueue with the specified capacity.
 
Method Summary
 AsynchEvent getEvent()
          Returns the next event in the sink, waiting forever till one is available.
 AsynchEvent getEvent(long waitTime)
          Returns the next event in the sink, waiting for waitTime.
 int getSize()
          Returns the number of events in the queue
 boolean isEmpty()
          Is the queue empty ?
 boolean isFull()
          Is the queue full ?
 boolean putEvent(AsynchEvent asynchEvent)
          Puts an event into the sink, waiting forever until there is room to place the event..
 boolean putEvent(AsynchEvent asynchEvent, int waitTime)
          Puts an event into the sink, waiting up to waitTime until there is room to place the event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsynchEventQueue

public AsynchEventQueue()
Constructs a AysnchEventQueue with a capacity of 20 events.


AsynchEventQueue

public AsynchEventQueue(int capacity)
Constructs a AysnchEventQueue with the specified capacity.

Method Detail

getEvent

public AsynchEvent getEvent()
                     throws java.lang.InterruptedException
Description copied from interface: AsynchEventSink
Returns the next event in the sink, waiting forever till one is available.

Specified by:
getEvent in interface AsynchEventSink
Returns:
an AsynchEvent
Throws:
java.lang.InterruptedException
See Also:
AsynchEventSink.getEvent()

getEvent

public AsynchEvent getEvent(long waitTime)
                     throws java.lang.InterruptedException
Description copied from interface: AsynchEventSink
Returns the next event in the sink, waiting for waitTime.

Specified by:
getEvent in interface AsynchEventSink
Parameters:
waitTime - - how long to wait for an event
Returns:
an AsynchEvent or null if there is no available in the time frame
Throws:
java.lang.InterruptedException
See Also:
AsynchEventSink.getEvent(long)

putEvent

public boolean putEvent(AsynchEvent asynchEvent)
                 throws java.lang.InterruptedException
Description copied from interface: AsynchEventSink
Puts an event into the sink, waiting forever until there is room to place the event..

Specified by:
putEvent in interface AsynchEventSink
Parameters:
asynchEvent - - the event to place in the sink
Returns:
true if the event could be placed in the sink
Throws:
java.lang.InterruptedException
See Also:
AsynchEventSink.putEvent(echopoint.asynch.AsynchEvent)

putEvent

public boolean putEvent(AsynchEvent asynchEvent,
                        int waitTime)
                 throws java.lang.InterruptedException
Description copied from interface: AsynchEventSink
Puts an event into the sink, waiting up to waitTime until there is room to place the event.

Specified by:
putEvent in interface AsynchEventSink
Parameters:
asynchEvent - - the event to place in the sink
waitTime - - how long to wait for room in the sink or - 1 to wait for ever
Returns:
true if the event could be placed in the sink or false if there is no room after the specified waitTime.
Throws:
java.lang.InterruptedException
See Also:
AsynchEventSink.putEvent(echopoint.asynch.AsynchEvent, int)

isFull

public boolean isFull()
Is the queue full ?


isEmpty

public boolean isEmpty()
Is the queue empty ?


getSize

public int getSize()
Returns the number of events in the queue

Returns:
the number of events in the queue

EchoPoint
1.0