org.jboss.util.timeout
Interface TimeoutPriorityQueue

All Known Implementing Classes:
HashedTimeoutPriorityQueueImpl, TimeoutPriorityQueueImpl

public interface TimeoutPriorityQueue

TimeoutPriorityQueue.

Version:
$Revision: 1.1.2.1 $
Author:
Adrian Brock

Method Summary
 void cancel()
          Cancels the queue
 void clear()
          Clears the queue
 TimeoutExt offer(long time, TimeoutTarget target)
          Add a timeout to the queue
 TimeoutExt peek()
          Retrieves but does not remove the top of the queue or null if there is no such element
 TimeoutExt poll()
          Retrieves and removes the top of the queue if it times out or null if there is no such element
 TimeoutExt poll(long wait)
          Retrieves and removes the top of the queue if it times out or null if there is no such element
 boolean remove(TimeoutExt timeout)
          Removes the passed timeout from the queue
 int size()
          The size of the queue
 TimeoutExt take()
          Take a timeout when it times out
 

Method Detail

offer

TimeoutExt offer(long time,
                 TimeoutTarget target)
Add a timeout to the queue

Parameters:
time - the time of the timeout
target - the timeout target
Returns:
timeout when it was added to the queue, false otherwise

take

TimeoutExt take()
Take a timeout when it times out

Returns:
the top the queue or null if the queue is cancelled

poll

TimeoutExt poll()
Retrieves and removes the top of the queue if it times out or null if there is no such element

Returns:
the top the queue or null if the queue is empty

poll

TimeoutExt poll(long wait)
Retrieves and removes the top of the queue if it times out or null if there is no such element

Parameters:
wait - how to long to wait in milliseconds if the queue is empty
Returns:
the top of the queue or null if the queue is empty

peek

TimeoutExt peek()
Retrieves but does not remove the top of the queue or null if there is no such element

Returns:
the top of the queue or null if the queue is empty

remove

boolean remove(TimeoutExt timeout)
Removes the passed timeout from the queue

Returns:
true when the timeout was removed

clear

void clear()
Clears the queue


cancel

void cancel()
Cancels the queue


size

int size()
The size of the queue



Copyright © 2002 JBoss Group, LLC. All Rights Reserved.