|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.erights.e.elib.vat.Runner | +--org.erights.e.elib.vat.HeadlessRunner
A redirectable Runner, mostly for internal use.
Field Summary | |
private static int |
DEQUEUE_GRANULARITY
The number of Runnables to dequeue and run in one go. |
private FlexSet |
myDeadManSwitches
The DeadManSwitches I need to inform if I shutdown. |
private SynchQueue |
myOptQ
Where PendingEvents are to be enqueued, or null if I've been redirected. |
private Runner |
myOptTarget
The Runner that this Runner has been redirected to, or null if this Runner is fresh. |
private RunnerThread |
myOptThread
The RunnerThread servicing this Runner's queue. |
private Object |
myQLock
myOptQ's internal lock. |
Fields inherited from class org.erights.e.elib.vat.Runner |
myOptServingVat, myServingTicket |
Constructor Summary | |
(package private) |
HeadlessRunner(String optName)
Makes a Vat, and starts the thread that services its queue. |
Method Summary | |
(package private) void |
addDeadManSwitch(Object deadManSwitch)
Remember the deadManSwitch, so that if I'm shut down, I can notify him. |
(package private) void |
disturbEvent(Throwable t)
Performs a Thread.stop(t) on the thread executing the current event. |
protected 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) Runner |
redirect(Runner newRunner)
If the enabling conditions are met, then requeue all my events onto newRunner's queue, and remember to redirect all further requests to newRunner. |
void |
run()
Called only by Thread.start() . |
(package private) void |
setPriority(int newPriority)
Requests a change of priority of the thread servicing this Runner. |
(package private) Runner |
shorten()
If x.shorten() != x, then this Runner is no more, and should not be used. |
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 |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final int DEQUEUE_GRANULARITY
private transient RunnerThread myOptThread
If we ever go orthogonal again, myOptThread must not be checkpointed. Ie, it must be a DISALLOWED_FIELD or 'transient' or something.
private Runner myOptTarget
private SynchQueue myOptQ
Note that SynchQueue is a thread-safe data structure with its own lock which we hold in myQLock.
private final Object myQLock
private FlexSet myDeadManSwitches
Constructor Detail |
HeadlessRunner(String optName)
optName
- is the name to give to the created thread.Method Detail |
public String toString()
Object
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())
toString
in class Object
Runner shorten()
Runner
HeadlessRunner
s.
shorten
in class Runner
String getRunnerKind()
Runner
A kind of Runner determines which kind of "devices" (eg, AWT or SWT widgets) may be synchronously accessed from within this Runner
getRunnerKind
in class Runner
protected Throwable enqueue(PendingEvent todo)
Runner
enqueue
in class Runner
void setPriority(int newPriority)
Runner
setPriority
in class Runner
void disturbEvent(Throwable t)
Runner
Note that Thread.stop() does not stop the thread (obvious huh?), but rather causes that thread to experience a "spontaneously" thrown exception.
disturbEvent
in class Runner
boolean isCurrent()
Runner
If it is, we say we are executing inside this Runner.
r.isCurrent() implies
Runner.getCurrentRunner()
== r.
isCurrent
in class Runner
public void run()
Thread.start()
.
(XXX It's a modularity bug for this to be public.) Pulls PendingEvents from the queue until there aren't any more, then waits until there's more to do.
run
in interface Runnable
java.lang.Thread#run()
Runner redirect(Runner newRunner)
The enabling conditions are
ViciousCycleException
.)
void addDeadManSwitch(Object deadManSwitch)
Runner
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.
addDeadManSwitch
in class Runner
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |