Package edu.jas.util
Class ExecutableServer
- java.lang.Object
-
- java.lang.Thread
-
- edu.jas.util.ExecutableServer
-
- All Implemented Interfaces:
java.lang.Runnable
public class ExecutableServer extends java.lang.Thread
ExecutableServer is used to receive and execute classes.- Author:
- Heinz Kredel
-
-
Field Summary
Fields Modifier and Type Field Description protected ChannelFactorycfChannelFactory to use.static intDEFAULT_PORTDefault port to listen to.static java.lang.StringDONEConstant to signal completion.protected java.util.List<edu.jas.util.Executor>serversList of server threads.static java.lang.StringSTOPConstant to request shutdown.
-
Constructor Summary
Constructors Constructor Description ExecutableServer()ExecutableServer on default port.ExecutableServer(int port)ExecutableServer.ExecutableServer(ChannelFactory cf)ExecutableServer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinit()thread initialization and start.static voidmain(java.lang.String[] args)main method to start serving thread.voidrun()run is main server method.intsize()number of servers.voidterminate()terminate all servers.java.lang.StringtoString()String representation.-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, yield
-
-
-
-
Field Detail
-
cf
protected final ChannelFactory cf
ChannelFactory to use.
-
servers
protected java.util.List<edu.jas.util.Executor> servers
List of server threads.
-
DEFAULT_PORT
public static final int DEFAULT_PORT
Default port to listen to.- See Also:
- Constant Field Values
-
DONE
public static final java.lang.String DONE
Constant to signal completion.- See Also:
- Constant Field Values
-
STOP
public static final java.lang.String STOP
Constant to request shutdown.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ExecutableServer
public ExecutableServer()
ExecutableServer on default port.
-
ExecutableServer
public ExecutableServer(int port)
ExecutableServer.- Parameters:
port-
-
ExecutableServer
public ExecutableServer(ChannelFactory cf)
ExecutableServer.- Parameters:
cf- channel factory to reuse.
-
-
Method Detail
-
main
public static void main(java.lang.String[] args) throws java.lang.InterruptedException
main method to start serving thread.- Parameters:
args- args[0] is port- Throws:
java.lang.InterruptedException
-
init
public void init()
thread initialization and start.
-
size
public int size()
number of servers.
-
run
public void run()
run is main server method.- Specified by:
runin interfacejava.lang.Runnable- Overrides:
runin classjava.lang.Thread
-
terminate
public void terminate()
terminate all servers.
-
toString
public java.lang.String toString()
String representation.- Overrides:
toStringin classjava.lang.Thread
-
-