Package com.sun.akuma
Class EchoServer
java.lang.Object
com.sun.akuma.Daemon
com.sun.akuma.NetworkServer
com.sun.akuma.EchoServer
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 -
Method Summary
Modifier and TypeMethodDescriptionprotected ServerSocket
Creates a boundServerSocket
that will be shared by all worker processes.protected void
forkWorkers
(JavaVMArguments args) Forks the worker thread with the given JVM args.protected void
frontend()
Front-end.static void
protected boolean
Daemonize if something is given as arguments.protected void
worker
(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
-
Constructor Details
-
EchoServer
-
-
Method Details
-
main
- Throws:
Exception
-
shouldBeDaemonized
protected boolean shouldBeDaemonized()Daemonize if something is given as arguments.- Overrides:
shouldBeDaemonized
in classNetworkServer
-
frontend
Description copied from class:NetworkServer
Front-end.- Overrides:
frontend
in classNetworkServer
- Throws:
Exception
-
forkWorkers
Description copied from class:NetworkServer
Forks 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:
forkWorkers
in classNetworkServer
- Throws:
Exception
-
createServerSocket
Description copied from class:NetworkServer
Creates a boundServerSocket
that will be shared by all worker processes. This method is called in the frontend process.- Specified by:
createServerSocket
in classNetworkServer
- Throws:
Exception
-
worker
Description copied from class:NetworkServer
Worker thread main code.- Specified by:
worker
in classNetworkServer
- Parameters:
ss
- The server socket that the frontend process created.- Throws:
Exception
-