org.jawk.jrt
Class BulkBlockObject

java.lang.Object
  extended by org.jawk.jrt.BlockObject
      extended by org.jawk.jrt.BulkBlockObject

public final class BulkBlockObject
extends BlockObject

A convenience class that blocks until any Blockable in the handles set is ready with data (i.e., will not block). It's like BlockObject in that this is returned to the AVM/AwkScript for execution by the BlockManager. Unlike the BlockObject, however, it implements the block() and getNotifierTag() to manage blocking for a collection of Blockables.

See Also:
BlockManager, BlockObject

Constructor Summary
BulkBlockObject(java.lang.String prefix, java.util.Map<java.lang.String,? extends Blockable> blockables, VariableManager vm)
          Construct a block object which waits for any Blockable within the set of Blockables to "unblock".
 
Method Summary
 void block()
          Block until meaningful data is made available for the client application.
 boolean containsHandle(java.lang.String handle)
           
 java.lang.String getNotifierTag()
          What to return to the client code when a handle is non-blocking.
 BlockObject populateHandleSet(java.lang.Object[] args, VariableManager vm)
           
 BlockObject populateHandleSet(java.lang.Object[] args, VariableManager vm, BlockHandleValidator validator)
           
 
Methods inherited from class org.jawk.jrt.BlockObject
clearNextBlockObject, getBlockObjects, setNextBlockObject, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BulkBlockObject

public BulkBlockObject(java.lang.String prefix,
                       java.util.Map<java.lang.String,? extends Blockable> blockables,
                       VariableManager vm)
Construct a block object which waits for any Blockable within the set of Blockables to "unblock".

Parameters:
prefix - First part of the return string for the block operation.
blockables - All universe of handles and their associated blockables.
vm - Required to obtain OFS (used in the construction of the return string / notifier tag).
Method Detail

containsHandle

public final boolean containsHandle(java.lang.String handle)

getNotifierTag

public final java.lang.String getNotifierTag()
What to return to the client code when a handle is non-blocking.

The format is as follows :

 prefix OFS handle
 

Specified by:
getNotifierTag in class BlockObject
Returns:
The client string containing the handle of the non-blocking object.

block

public final void block()
                 throws java.lang.InterruptedException
Description copied from class: BlockObject
Block until meaningful data is made available for the client application. This is called by the BlockManager in a way such that the BlockManager waits for one BlockObject to unblock.

Specified by:
block in class BlockObject
Throws:
java.lang.InterruptedException

populateHandleSet

public final BlockObject populateHandleSet(java.lang.Object[] args,
                                           VariableManager vm)

populateHandleSet

public final BlockObject populateHandleSet(java.lang.Object[] args,
                                           VariableManager vm,
                                           BlockHandleValidator validator)