Package org.sentrysoftware.jawk.jrt
Class BlockObject
java.lang.Object
org.sentrysoftware.jawk.jrt.BlockObject
An item which blocks until something useful can be
done with the object. The BlockManager multiplexes
BlockObjects such that unblocking one
BlockObject causes the BlockManager to dispatch
the notifier tag result of the BlockObject.
BlockObjects are chained. The BlockManager blocks on all chained BlockObjects until one is unblocked.
Subclasses must provide meaningful block() and getNotifierTag() routines.
BlockObjects do not actually perform the client blocking. This is done by the BlockManager at the AVM (interpreted) or compiled runtime environment. The AVM/compiled environments make special provision to return the head block object to the BlockManager (within _EXTENSION_ keyword processing).
- Author:
- Danny Daglas
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
block()
Block until meaningful data is made available for the client application.final void
Eliminate the rest of the BlockObject chain.Obtain all chained BlockObjects as a List, including this one.abstract String
Construct a meaningful notifier tag for this BlockObject.void
Chain this BlockObject to another BlockObject.final String
toString()
Ensure non-evaluation of a BlockObject by throwing an AWK Runtime exception, in case it leaks into AWK evaluation space.
-
Method Details
-
getNotifierTag
Construct a meaningful notifier tag for this BlockObject.- Returns:
- a
String
object
-
block
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.- Throws:
InterruptedException
- if any.
-
clearNextBlockObject
public final void clearNextBlockObject()Eliminate the rest of the BlockObject chain. -
setNextBlockObject
Chain this BlockObject to another BlockObject. The chain is linear and there is no upper bounds on the number of BlockObjects that can be supported.- Parameters:
bo
- aBlockObject
object
-
getBlockObjects
Obtain all chained BlockObjects as a List, including this one. A BlockObject chain cycle causes a runtime exception to be thrown.- Returns:
- A List of chained BlockObjects, including this one.
- Throws:
AwkRuntimeException
- if the BlockObject chain contains a cycle.
-
toString
Ensure non-evaluation of a BlockObject by throwing an AWK Runtime exception, in case it leaks into AWK evaluation space.
-