org.erights.e.elib.vat
Class PendingCall

java.lang.Object
  |
  +--org.erights.e.elib.vat.SendingContext
        |
        +--org.erights.e.elib.vat.PendingEvent
              |
              +--org.erights.e.elib.vat.PendingCall
All Implemented Interfaces:
EPrintable, Runnable

class PendingCall
extends PendingEvent

Used for Vat.now(Runnable)

Author:
E-Dean Tribble, Mark S. Miller

Field Summary
private  Object myLock
          Acts as a condition variable on "null == myOptTodo"
private  Throwable myOptProblem
          If myOptTodo threw a problem, then this is the problem.
private  Runnable myOptTodo
          If non-null, it is the thunk to be executed.
 
Fields inherited from class org.erights.e.elib.vat.SendingContext
 
Constructor Summary
(package private) PendingCall(Vat vat, Runnable todo)
          Captures creation context as sending context
 
Method Summary
 void __printOn(TextWriter out)
          Enabled:
 void innerRun()
          Called in the RunnerThread.
 void printContextOn(TextWriter out)
          Enabled:
 void report(String msg, Throwable problem)
          Trace at warning level that this event caused this problem.
 void run()
          Do now the event that this PendingEvent represents.
(package private)  void runNow()
          Called in the thread doing the now() or callNow().
 
Methods inherited from class org.erights.e.elib.vat.SendingContext
report, toString, trace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myLock

private final Object myLock
Acts as a condition variable on "null == myOptTodo"


myOptTodo

private Runnable myOptTodo
If non-null, it is the thunk to be executed.

Iff null, then we assume the thunk has been executed.


myOptProblem

private Throwable myOptProblem
If myOptTodo threw a problem, then this is the problem.

Meaningful iff null == myOptTodo. If myOptProblem is also null, then myOptTodo completed successfully.

Constructor Detail

PendingCall

PendingCall(Vat vat,
            Runnable todo)
Captures creation context as sending context

Method Detail

runNow

void runNow()
Called in the thread doing the now() or callNow().

Blocks until myOptTodo completes in the RunnerThread, at which point the outcome of myOptTodo becomes the outcome of the runNow(), and therefore the outcome of now().


innerRun

public void innerRun()
Called in the RunnerThread.

Specified by:
innerRun in class PendingEvent

__printOn

public void __printOn(TextWriter out)
               throws IOException
Description copied from interface: EPrintable
Enabled:

IOException

run

public final void run()
Do now the event that this PendingEvent represents.

Does bookkeeping of debugging info around call to PendingEvent.innerRun(), including catching all thrown Exceptions that escape from innerRun() reporting them rather than propogating them.

Specified by:
run in interface Runnable
See Also:
java.lang.Thread#run()

report

public void report(String msg,
                   Throwable problem)
Trace at warning level that this event caused this problem.


printContextOn

public void printContextOn(TextWriter out)
                    throws IOException
Description copied from class: SendingContext
Enabled:

Overrides:
printContextOn in class SendingContext
IOException


comments?