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
| Methods inherited from class com.sun.akuma.Daemon |
all, chdirToRoot, closeDescriptors, daemonize, daemonize, getCurrentExecutable, init, init, isDaemonized, selfExec, writePidFile |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EchoServer
public EchoServer(String[] args)
main
public static void main(String[] args)
throws Exception
- Throws:
Exception
shouldBeDaemonized
protected boolean shouldBeDaemonized()
- Daemonize if something is given as arguments.
- Overrides:
shouldBeDaemonized in class NetworkServer
frontend
protected void frontend()
throws Exception
- Description copied from class:
NetworkServer
- Front-end.
- Overrides:
frontend in class NetworkServer
- Throws:
Exception
forkWorkers
protected void forkWorkers(JavaVMArguments args)
throws Exception
- 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 into
NetworkServer.forkWorkerThreads(JavaVMArguments, int).
- Specified by:
forkWorkers in class NetworkServer
- Throws:
Exception
createServerSocket
protected ServerSocket createServerSocket()
throws Exception
- Description copied from class:
NetworkServer
- Creates a bound
ServerSocket that will be shared by all worker processes.
This method is called in the frontend process.
- Specified by:
createServerSocket in class NetworkServer
- Throws:
Exception
worker
protected void worker(ServerSocket ss)
throws Exception
- Description copied from class:
NetworkServer
- Worker thread main code.
- Specified by:
worker in class NetworkServer
- Parameters:
ss - The server socket that the frontend process created.
- Throws:
Exception
Copyright © 2011. All Rights Reserved.