stella.net
Class ParameterRelay.ParameterHandler

java.lang.Object
  extended by java.lang.Thread
      extended by stella.net.Handler
          extended by stella.net.ParameterRelay.ParameterHandler
All Implemented Interfaces:
Runnable
Enclosing class:
ParameterRelay

protected class ParameterRelay.ParameterHandler
extends Handler

The helper class to run the protocol for ascii-based parameter exchanges. In its run method, the queried parameter name is read in from the socket stream, matched to the parameters served by the enclosing class, converted to an ascii-representation and writtn to the output stream of the socket.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
private  BufferedReader buffIn
          The buffered reader wrapped around the socket's input stream.
private  BufferedWriter buffOut
          The print writer wrapped around the socket's output stream.
private  boolean cancel
          Becomes true if the protocol should be terminated.
 
Fields inherited from class stella.net.Handler
in, out, spawner
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected ParameterRelay.ParameterHandler(ErrorProcessing spawn, Socket client, ThreadGroup group, String name)
          Constructs a new parameter-request handler.
 
Method Summary
 void cancel()
          Indicates that the protocol submission should be terminated.
 void init()
          Wrapps buffered readers/writers around the generic socket streams.
protected  void runProtocol()
          The main method of the parameter server protocol.
 
Methods inherited from class stella.net.Handler
close, run
 
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

buffIn

private BufferedReader buffIn
The buffered reader wrapped around the socket's input stream.


buffOut

private BufferedWriter buffOut
The print writer wrapped around the socket's output stream.


cancel

private boolean cancel
Becomes true if the protocol should be terminated.

Constructor Detail

ParameterRelay.ParameterHandler

protected ParameterRelay.ParameterHandler(ErrorProcessing spawn,
                                          Socket client,
                                          ThreadGroup group,
                                          String name)
Constructs a new parameter-request handler. The streams associated to the client-connection socket are opened in the parent class, see Handler.

Parameters:
spawn - A reference to the spawning receiver server.
client - The client-connection socket.
group - The thread group this command handler should run in.
name - The name of the handler thread.
Method Detail

init

public void init()
Wrapps buffered readers/writers around the generic socket streams.

Overrides:
init in class Handler

runProtocol

protected void runProtocol()
The main method of the parameter server protocol. This protocol does the following:

Specified by:
runProtocol in class Handler

cancel

public void cancel()
Indicates that the protocol submission should be terminated. No terminal done is sent back, this method more or less is a surrogate to the deprechated stop method.