|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
stella.net.CasterClient.CommandSender
protected class CasterClient.CommandSender
The helper thread for this ascii caster to handle a
command/acknowledge/done
sequence. This thread is started after the connection to the
command receiver (server) has been established. To allow the main thread
to return-fast from its 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.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
Thread.State, Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
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. |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
protected |
CasterClient.CommandSender(ThreadGroup group,
CommandEvent cmd)
Constructs a new command sender. |
| Method Summary | |
|---|---|
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. |
| 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 |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private CommandEvent command
private boolean cancel
private static final String FIRSTACKNOWLEDGE
private static final String COMPLETE
| Constructor Detail |
|---|
protected CasterClient.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.
| Method Detail |
|---|
public void cancel()
public void run()
run in interface Runnablerun in class Threadpublic void setOff(String alarm)
setOff in interface AlarmHandler
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||