com.sun.akuma
Class EchoServer

java.lang.Object
  extended by com.sun.akuma.Daemon
      extended by com.sun.akuma.NetworkServer
          extended by 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
EchoServer(java.lang.String[] args)
           
 
Method Summary
protected  java.net.ServerSocket createServerSocket()
          Creates a bound ServerSocket 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 main(java.lang.String[] args)
           
protected  boolean shouldBeDaemonized()
          Daemonize if something is given as arguments.
protected  void worker(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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EchoServer

public EchoServer(java.lang.String[] args)
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:
shouldBeDaemonized in class NetworkServer

frontend

protected void frontend()
                 throws java.lang.Exception
Description copied from class: NetworkServer
Front-end.

Overrides:
frontend in class NetworkServer
Throws:
java.lang.Exception

forkWorkers

protected void forkWorkers(JavaVMArguments args)
                    throws java.lang.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:
java.lang.Exception

createServerSocket

protected java.net.ServerSocket createServerSocket()
                                            throws java.lang.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:
java.lang.Exception

worker

protected void worker(java.net.ServerSocket ss)
               throws java.lang.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:
java.lang.Exception


Copyright © 2012. All Rights Reserved.