org.erights.e.elib.vat
Class DeadRunner

java.lang.Object
  |
  +--org.erights.e.elib.vat.Runner
        |
        +--org.erights.e.elib.vat.DeadRunner

final class DeadRunner
extends Runner

To shutdown a Vat is to merge it into a DeadRunner.

Since a DeadRunner is immutable, it needs no synchronization.

Author:
Mark S. Miller, From an idea by Dean Tribble

Field Summary
private  Ref myBroken
           
private  Throwable myProblem
          Why is this Vat dead?
 
Fields inherited from class org.erights.e.elib.vat.Runner
myOptServingVat, myServingTicket
 
Constructor Summary
(package private) DeadRunner(Throwable problem)
           
 
Method Summary
(package private)  void addDeadManSwitch(Object deadManSwitchRef)
          Remember the deadManSwitch, so that if I'm shut down, I can notify him.
(package private)  void disturbEvent(Throwable t)
          Does nothing, since we're already doing nothing.
(package private)  Throwable enqueue(PendingEvent todo)
          Add todo to the queue my thread is servicing
(package private)  String getRunnerKind()
          What kind of Runner is this?
(package private)  boolean isCurrent()
          Is the current thread this Runner's thread (the thread servicing this Vat)?
(package private)  void setPriority(int newPriority)
          Does nothing, since a DeadRunner has thread or priority.
 String toString()
          Suppressed: Returns a string representation of the object.
 
Methods inherited from class org.erights.e.elib.vat.Runner
getCurrentRunner, getOptCurrentRunner, getOptEStack, getOptServingVat, obtainRunner, obtainRunner, popEStackItem, pushEStackItem, requireCurrent, servingTicket, shorten
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myProblem

private final Throwable myProblem
Why is this Vat dead?


myBroken

private final Ref myBroken
Constructor Detail

DeadRunner

DeadRunner(Throwable problem)
Parameters:
problem - Why is this Vat dead?
Method Detail

toString

public String toString()
Description copied from class: Object
Suppressed: Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Overrides:
toString in class Object
Returns:
a string representation of the object.

setPriority

void setPriority(int newPriority)
Does nothing, since a DeadRunner has thread or priority.

Specified by:
setPriority in class Runner

getRunnerKind

String getRunnerKind()
Description copied from class: Runner
What kind of Runner is this?

A kind of Runner determines which kind of "devices" (eg, AWT or SWT widgets) may be synchronously accessed from within this Runner

Specified by:
getRunnerKind in class Runner
Returns:
"dead"

isCurrent

boolean isCurrent()
Description copied from class: Runner
Is the current thread this Runner's thread (the thread servicing this Vat)?

If it is, we say we are executing inside this Runner.

r.isCurrent() implies Runner.getCurrentRunner() == r.

Specified by:
isCurrent in class Runner
Returns:
false, since a DeadRunner is never current.

disturbEvent

void disturbEvent(Throwable t)
Does nothing, since we're already doing nothing.

Specified by:
disturbEvent in class Runner

enqueue

Throwable enqueue(PendingEvent todo)
Description copied from class: Runner
Add todo to the queue my thread is servicing

Specified by:
enqueue in class Runner
Returns:
The problem explaining why this Vat is broken.

addDeadManSwitch

void addDeadManSwitch(Object deadManSwitchRef)
Description copied from class: Runner
Remember the deadManSwitch, so that if I'm shut down, I can notify him.

The deadManSwitch is only notified if it's be a boot-ref (a Ref handled by a BootRefHandler whose target's vat is a vat handled by a different Runner. Otherwise, the notification would need to occur in this Runner, which is presumably already shut down.

Specified by:
addDeadManSwitch in class Runner


comments?