uPortal 2.4.1
API Documentation

org.jasig.portal.utils.threading
Class BoundedQueue

java.lang.Object
  extended byorg.jasig.portal.utils.threading.BoundedQueue
All Implemented Interfaces:
Queue

public class BoundedQueue
extends java.lang.Object
implements Queue


Constructor Summary
BoundedQueue(int capacity)
          Creates a BoucedQueue with no elements
 
Method Summary
 boolean isEmpty()
          Checks if the queue is empty
 boolean isFull()
          Checks to see if the queue is full
 void put(java.lang.Object o)
          Puts an item into the Queue
 int size()
          Gets the total number of items in the queue
 java.lang.Object take()
          Takes the next item in the Queue, if there are no items in the queue the thread is blocked until there is.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BoundedQueue

public BoundedQueue(int capacity)
Creates a BoucedQueue with no elements

Parameters:
capacity - the max number of items this queue may contain
Method Detail

isEmpty

public boolean isEmpty()
Checks if the queue is empty

Specified by:
isEmpty in interface Queue
Returns:
True if the queue contains no items, false if not

isFull

public boolean isFull()
Checks to see if the queue is full

Specified by:
isFull in interface Queue
Returns:
True if the queue can contain no more items, false if not. False is also returned if the queue has no limit on the number of items it can contain

size

public int size()
Gets the total number of items in the queue

Specified by:
size in interface Queue
Returns:
the number of items currently in the queue

put

public void put(java.lang.Object o)
         throws java.lang.InterruptedException
Puts an item into the Queue

Specified by:
put in interface Queue
Parameters:
o - the item being placed in the queue
Throws:
java.lang.InterruptedException - thrown when a thread is waiting to place an item into a full queue and another thread interrupts it

take

public java.lang.Object take()
                      throws java.lang.InterruptedException
Takes the next item in the Queue, if there are no items in the queue the thread is blocked until there is.

Specified by:
take in interface Queue
Returns:
The next Object in the queue
Throws:
java.lang.InterruptedException - thrown when a thread is waiting get an item from an empty queue and another thread interrupts it

uPortal 2.4.1
API Documentation