protected class CasterClient.CommandSender extends Thread implements AlarmHandler
CasterClient.castCommand(stella.CommandEvent) method this
helper thread
does the whole handling of writing the command to the socket as an
ASCII-String, waiting for the acknowledge and done replies and
call time-out handlers if necessary.Please not that any command sent to the server must be terminated with a final done regardless of errors occuring or further commands sent during the processing of the actual command!
To avoid time-consuming construction of lookup-tables for each command sent this class uses static lookup-tables that are constructed only once.
Thread.State, Thread.UncaughtExceptionHandler| Modifier and Type | Field and Description |
|---|---|
private boolean |
cancel
Gets true if this thread should terminate unexpectedly.
|
private CommandEvent |
command
The command to send to the server.
|
private static String |
COMPLETE
The name for alarms waiting for done or additional acknowledges.
|
private static String |
FIRSTACKNOWLEDGE
The name for alarms waiting for the first acknowledge.
|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| Modifier | Constructor and Description |
|---|---|
protected |
CommandSender(ThreadGroup group,
CommandEvent cmd)
Constructs a new command sender.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Cancels the current cycle.
|
void |
run()
The main method of the command sender.
|
void |
setOff(String alarm)
The method called by the internal alarms of this caster if a problem
with in-time replies occured.
|
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, yieldprivate CommandEvent command
private boolean cancel
private static final String FIRSTACKNOWLEDGE
private static final String COMPLETE
protected CommandSender(ThreadGroup group, CommandEvent cmd)
This thread is not started automatically.
Note that construction may be blocked if the server is not accepting
connetions, see CasterClient.KEY_RETRYCOUNT and CasterClient.KEY_RETRYSLEEP.
public void cancel()
public void run()
public void setOff(String alarm)
setOff in interface AlarmHandler