Package com.sun.akuma
Class EchoServer
- java.lang.Object
-
- com.sun.akuma.Daemon
-
- com.sun.akuma.NetworkServer
-
- com.sun.akuma.EchoServer
-
public class EchoServer extends NetworkServer
Sample echo server.- Author:
- Kohsuke Kawaguchi
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.sun.akuma.Daemon
Daemon.WithoutChdir
-
-
Field Summary
-
Fields inherited from class com.sun.akuma.NetworkServer
arguments
-
-
Constructor Summary
Constructors Constructor Description EchoServer(java.lang.String[] args)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.net.ServerSocketcreateServerSocket()Creates a boundServerSocketthat will be shared by all worker processes.protected voidforkWorkers(JavaVMArguments args)Forks the worker thread with the given JVM args.protected voidfrontend()Front-end.static voidmain(java.lang.String[] args)protected booleanshouldBeDaemonized()Daemonize if something is given as arguments.protected voidworker(java.net.ServerSocket ss)Worker thread main code.-
Methods inherited from class com.sun.akuma.NetworkServer
forkWorkerThreads, run, worker
-
Methods inherited from class com.sun.akuma.Daemon
all, chdirToRoot, closeDescriptors, daemonize, daemonize, getCurrentExecutable, init, init, isDaemonized, selfExec, writePidFile
-
-
-
-
Method Detail
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception- Throws:
java.lang.Exception
-
shouldBeDaemonized
protected boolean shouldBeDaemonized()
Daemonize if something is given as arguments.- Overrides:
shouldBeDaemonizedin classNetworkServer
-
frontend
protected void frontend() throws java.lang.ExceptionDescription copied from class:NetworkServerFront-end.- Overrides:
frontendin classNetworkServer- Throws:
java.lang.Exception
-
forkWorkers
protected void forkWorkers(JavaVMArguments args) throws java.lang.Exception
Description copied from class:NetworkServerForks the worker thread with the given JVM args. The implementation is expected to modify the arguments to suit their need, then call intoNetworkServer.forkWorkerThreads(JavaVMArguments, int).- Specified by:
forkWorkersin classNetworkServer- Throws:
java.lang.Exception
-
createServerSocket
protected java.net.ServerSocket createServerSocket() throws java.lang.ExceptionDescription copied from class:NetworkServerCreates a boundServerSocketthat will be shared by all worker processes. This method is called in the frontend process.- Specified by:
createServerSocketin classNetworkServer- Throws:
java.lang.Exception
-
worker
protected void worker(java.net.ServerSocket ss) throws java.lang.ExceptionDescription copied from class:NetworkServerWorker thread main code.- Specified by:
workerin classNetworkServer- Parameters:
ss- The server socket that the frontend process created.- Throws:
java.lang.Exception
-
-