com.mischiefbox.dmud
Class Server

java.lang.Object
  |
  +--com.mischiefbox.dmud.Server

public class Server
extends Object

Implements a DMUD server.

Version:
$Id: Server.java,v 1.1.1.1 2001/06/27 01:33:17 cjones Exp $
Author:
Chris Jones

Field Summary
protected  ConnectionHandler connectionHandler
          The connection handler.
protected  int iPort
          The server port on which to listen.
protected  int iProcessorThreadsMax
          The maximum number of processor threads.
protected  Listener listener
          The listener.
protected  ProcessorThread[] paProcessor
          The array of processor threads.
static int PROCESSOR_THREAD_COUNT
          The default number of processor threads.
static String PROCESSOR_THREAD_GROUP
          The default name of the processor thread group.
protected  InputQueue qInput
          The common input queue.
protected  Queue qOutput
          The common output queue.
static int SERVER_PORT
          The default port on which to listen.
protected  String sProcessorThreadGroup
          The name of the processor thread group.
protected  ThreadGroup tgProcessor
          The processor thread group.
 
Constructor Summary
Server()
          Create a new server.
 
Method Summary
 Listener getListener()
          Get the listener.
static void main(String[] args)
          Command line method to start the server.
 void setPort(int iPort)
          Set the server port.
 void setThreadCount(int iThreads)
          Set the maximum number of processor threads.
 void setThreadGroupName(String sGroup)
          Set the processor thread group name.
 void startServer()
          Start this server.
 void stopServer()
          Stop this server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVER_PORT

public static final int SERVER_PORT
The default port on which to listen.

PROCESSOR_THREAD_COUNT

public static final int PROCESSOR_THREAD_COUNT
The default number of processor threads.

The number of processor threads is directly proportional to the number of simultaneous commands that may be executed.


PROCESSOR_THREAD_GROUP

public static final String PROCESSOR_THREAD_GROUP
The default name of the processor thread group.

This is really only useful when debugging.


iPort

protected int iPort
The server port on which to listen.

iProcessorThreadsMax

protected int iProcessorThreadsMax
The maximum number of processor threads.

sProcessorThreadGroup

protected String sProcessorThreadGroup
The name of the processor thread group.

qInput

protected InputQueue qInput
The common input queue.

qOutput

protected Queue qOutput
The common output queue.

connectionHandler

protected ConnectionHandler connectionHandler
The connection handler.

listener

protected Listener listener
The listener.

tgProcessor

protected ThreadGroup tgProcessor
The processor thread group.

paProcessor

protected ProcessorThread[] paProcessor
The array of processor threads.
Constructor Detail

Server

public Server()
Create a new server.
Method Detail

setPort

public void setPort(int iPort)
Set the server port.

This will not change the listening port on an already running server.

Parameters:
iPort - the server port on which to listen.

setThreadCount

public void setThreadCount(int iThreads)
Set the maximum number of processor threads.

This will not change the number of threads in an already running server.

Parameters:
iThreads - the number of processor threads to create.

setThreadGroupName

public void setThreadGroupName(String sGroup)
Set the processor thread group name.

This will not change the processor thread group name in an already running server.

Parameters:
sGroup - the thread group name.

getListener

public Listener getListener()
Get the listener.
Returns:
the listener if the server is running, null otherwise.

startServer

public void startServer()
Start this server. Begin listening for connections and processing their request messages.

stopServer

public void stopServer()
Stop this server. Shut down the listener. Stop the connection handler. Kill the processor threads.

main

public static void main(String[] args)
Command line method to start the server.


Copyright © 2001 by Christopher R. Jones. All Rights Reserved.