20120618, rgf

org.rexxla.bsf.engines.rexx
Class RexxAndJava.SyncPutGet

java.lang.Object
  extended by org.rexxla.bsf.engines.rexx.RexxAndJava.SyncPutGet
Enclosing class:
RexxAndJava

protected class RexxAndJava.SyncPutGet
extends java.lang.Object

Inner class to implement a Synchronized ReaderWriter, where a read on an empty Vector blocks the read, until a write occurs (with optional timeout).


Constructor Summary
protected RexxAndJava.SyncPutGet()
           
 
Method Summary
(package private)  java.lang.Object get(long millis)
          Get an object from the vector.
(package private)  void put(java.lang.Object o, int priority)
          Adds an object to the vector and makes sure that waiting threads are notified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RexxAndJava.SyncPutGet

protected RexxAndJava.SyncPutGet()
Method Detail

get

java.lang.Object get(long millis)
               throws java.lang.InterruptedException
Get an object from the vector. If empty, block for the given time.

Parameters:
millis - time to wait in milliseconds, if 0 waits until an object becomes available.
Returns:
the first object from the vector or null, if empty.
Throws:
java.lang.InterruptedException

put

void put(java.lang.Object o,
         int priority)
Adds an object to the vector and makes sure that waiting threads are notified.

Parameters:
o - object to add to the vector.
priority - an integer value indicating the priority of the posted event, one of:

  • "2": high ('alarm level') priority.
  • "1": normal (default) priority, and
  • "0": low ('batch level') priority,

20120618, rgf