sunlabs.brazil.template
Class QueueTemplate.Queue

java.lang.Object
  |
  +--sunlabs.brazil.template.QueueTemplate.Queue
Enclosing class:
QueueTemplate

public static class QueueTemplate.Queue
extends Object

Create an object queue. "Getters" wait 'till something appears in the queue.


Field Summary
static int max
           
 
Constructor Summary
QueueTemplate.Queue()
          Create a new Q of a maximum possible size
 
Method Summary
 void clear()
          Clear the queue.
 long count()
          Return the total number of items Q'd.
 Object get(int timeout)
          Return the next item on the queue, waiting for up to "timeout" seconds or for an interrupt.
 boolean isClosed()
          get the closed state
 void kick()
          Send a notify: for debugging
 long lastIn()
          Return the last time a Q insertion was attempted.
 long lastOut()
          Return the last time a Q removal was attempted.
 boolean put(Object item)
          Put an item on the queue if it's open and not full.
 boolean put(Object item, boolean force)
          Put an item on the queue if it's not full.
 boolean setClosed(boolean closed)
          set the closed state
 int size()
          How many items are queue'd.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

max

public static int max
Constructor Detail

QueueTemplate.Queue

public QueueTemplate.Queue()
Create a new Q of a maximum possible size

Method Detail

get

public Object get(int timeout)
Return the next item on the queue, waiting for up to "timeout" seconds or for an interrupt.

Returns:
the top of the Q, or null.

put

public boolean put(Object item)
Put an item on the queue if it's open and not full.


put

public boolean put(Object item,
                   boolean force)
Put an item on the queue if it's not full. If "force" is true, override the "closed" flag.


size

public int size()
How many items are queue'd.


kick

public void kick()
Send a notify: for debugging


lastIn

public long lastIn()
Return the last time a Q insertion was attempted. -1 if no attempts were made.


lastOut

public long lastOut()
Return the last time a Q removal was attempted. -1 if no attempts were made.


count

public long count()
Return the total number of items Q'd.


clear

public void clear()
Clear the queue.


setClosed

public boolean setClosed(boolean closed)
set the closed state


isClosed

public boolean isClosed()
get the closed state


Version 2.1, Generated 12/30/04
Copyright (c) 2001-2004, Sun Microsystems.