net.sf.jradius.server
Class ObjectQueue

java.lang.Object
  extended by net.sf.jradius.server.ObjectQueue
All Implemented Interfaces:
java.io.Serializable

public class ObjectQueue
extends java.lang.Object
implements java.io.Serializable

A thread-safe request queue

Author:
David Bird
See Also:
Serialized Form

Constructor Summary
ObjectQueue()
           
ObjectQueue(java.util.List list)
           
 
Method Summary
 java.lang.Object dequeue()
           
 java.lang.Object dequeue(long timeout)
          Dequeue an object in a thread-safe manner
 boolean enqueue(java.lang.Object o)
          Enqueue an object in a thread-safe manner
 java.lang.Object poll()
          This method will instantly return with the next object or null
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectQueue

public ObjectQueue()

ObjectQueue

public ObjectQueue(java.util.List list)
Method Detail

enqueue

public boolean enqueue(java.lang.Object o)
Enqueue an object in a thread-safe manner

Parameters:
o - The object to enqueue
Returns:
Returns true on success, false if queue is at its size limit

dequeue

public java.lang.Object dequeue()
                         throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

poll

public java.lang.Object poll()
This method will instantly return with the next object or null

Returns:
Returns the next object otherwise null

dequeue

public java.lang.Object dequeue(long timeout)
                         throws java.lang.InterruptedException
Dequeue an object in a thread-safe manner

Parameters:
timeout - The timeout willing to wait for an object
Returns:
Returns the next object
Throws:
java.lang.InterruptedException


Copyright © 2006 The JRadius Project, All Rights Reserved.