org.psepr.jClient
Class EventQueue

java.lang.Object
  extended by org.psepr.jClient.EventQueue
All Implemented Interfaces:
EventReceiver

public class EventQueue
extends java.lang.Object
implements EventReceiver

Author:
radams1

Constructor Summary
EventQueue()
           
EventQueue(int maxx)
           
 
Method Summary
 int getEventCount()
           
 int getMaxEvents()
           
 PsEPREvent nextEvent()
          Returns the next available packet.
 PsEPREvent nextEvent(long timeout)
          Returns the next available event.
 PsEPREvent pollEvent()
          Polls to see if a event is currently available and returns it, or immediately returns null if no packets are currently in the result queue.
 boolean receiveEvent(PsEPREvent pEvent)
          Handle the received event.
 void setMaxEvents(int xx)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventQueue

public EventQueue()

EventQueue

public EventQueue(int maxx)
Method Detail

getMaxEvents

public int getMaxEvents()

setMaxEvents

public void setMaxEvents(int xx)

getEventCount

public int getEventCount()

pollEvent

public PsEPREvent pollEvent()
Polls to see if a event is currently available and returns it, or immediately returns null if no packets are currently in the result queue.

Returns:
the next packet result, or null if there are no more results.

nextEvent

public PsEPREvent nextEvent()
Returns the next available packet. The method call will block (not return) until a packet is available.

Returns:
the next available packet.

nextEvent

public PsEPREvent nextEvent(long timeout)
Returns the next available event. The method call will block (not return) until a packet is available or the timeout has elapased. If the timeout elapses without a result, null will be returned.

Parameters:
timeout - the amount of time to wait for the next event (in milleseconds).
Returns:
the next available event.

receiveEvent

public boolean receiveEvent(PsEPREvent pEvent)
Description copied from interface: EventReceiver
Handle the received event. This is called by the reception thread of the library so, if you are going to do alot of processing, pass this event off to another processing thread.

Specified by:
receiveEvent in interface EventReceiver
Returns:
true if something useful was done with the event