stella.rmi
Class ReceiverTorso.CommandHandler
java.lang.Object
java.lang.Thread
stella.rmi.ReceiverTorso.CommandHandler
- All Implemented Interfaces:
- Runnable
- Enclosing class:
- ReceiverTorso
protected class ReceiverTorso.CommandHandler
- extends Thread
Handles the incomming command. To allow fast-return of the
command-receiving end of the outer class, ReceiverTorso.rmiCommand(stella.CommandEvent), the
actual
command handling is done with a seperate class that is an extension to
Thread. It is constructed with the incomming command so multiple calls
to the outer classe's ReceiverTorso.rmiCommand(stella.CommandEvent) will not result in
errors.
The only use of the command-processing as an inner class is to allow
multiple, thread-safe command calls.
|
Method Summary |
void |
run()
The run method of the receiver. |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
cmd
private CommandEvent cmd
- The command to process.
ReceiverTorso.CommandHandler
protected ReceiverTorso.CommandHandler(ThreadGroup group,
CommandEvent com)
- Constructs a new command-handling thread. The initial command is
safely stored inside this helper class instance.
- Parameters:
group - The thread group this command handler should run in.cmd - The command to process.
run
public void run()
- The run method of the receiver. It sends back acknowledge objects as
appropriate counting down the acknowledge number from the initial
number returned by
ReceiverTorso.getAcknowledgeNumber(stella.CommandEvent). As long as
calls to the ReceiverTorso.processCommand(stella.CommandEvent, int) returns true the
acknowledge number is reduced until the
AcknowledgeEvent.PRIMARY_ACK is reached and a final done
event
is sent. If a call to ReceiverTorso.processCommand(stella.CommandEvent, int) returns false
this acknowledge chaining is broken: The error event is fetched with
ReceiverTorso.getLastError(), sent back to the error listeners, and the
command caster is notified with a final, successful, done event
(Note that unsuccessful done events are spared for
unexpected errors
that have no individual error handling procedure).
- Specified by:
run in interface Runnable- Overrides:
run in class Thread