zeus.actors.intrays
Class NIOServer

java.lang.Object
  extended byjava.lang.Thread
      extended byzeus.actors.intrays.NIOServer
All Implemented Interfaces:
InTray, java.lang.Runnable

public class NIOServer
extends java.lang.Thread
implements InTray

this is a souped up version of the native socket transport to take advantage of the nio libraries.


Field Summary
protected  Address address
           
private  java.nio.ByteBuffer buffer
           
private  java.util.LinkedList clients
           
protected  int connection_count
           
private  AgentContext context
           
static int DEFAULT_PORT_MAX
           
static int DEFAULT_PORT_MIN
           
protected  Queue inMail
          Data structure holding messages as they are read in
(package private)  java.nio.channels.SelectionKey key
           
protected  java.net.ServerSocket listenSocket
           
static int MAX_CONNECTIONS
           
static int MAX_QUEUE_LENGTH
           
 int maxMessageSize
           
protected  MailBox mbox
          Reference to MailBox of which this is a sub-component
protected  MsgHandler msgHandler
           
protected  boolean processing
           
private  java.nio.channels.Selector readSelector
           
(package private)  java.nio.channels.Selector selector
           
(package private)  java.nio.channels.ServerSocketChannel server
           
(package private)  java.nio.channels.SelectionKey serverKey
           
(package private)  java.net.ServerSocket socket
           
protected  long timeout
          timeout was originally private, but subclasses need to use it to construct there own treads of control, so I changed it to protected (ST -14/8/00)
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
NIOServer()
           
NIOServer(AgentContext context, MailBox mbox, Queue inMail)
           
 
Method Summary
 void debug(java.lang.String str)
           
protected  void finalize()
           
 Address getAddress()
           
 AgentContext getAgentContext()
           
 java.lang.String getResponseAddress()
          implement in haste, repent at leisure
 void lowerStatus()
           
 void newMsg(Performative msg)
          ensures that messages are processed // synchronized
 void normalStatus()
           
 void registerClient(java.nio.channels.SocketChannel client)
           
 void run()
           
 void serviceClients()
           
 void stopProcessing()
           
 void updateCount(int x)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_CONNECTIONS

public static final int MAX_CONNECTIONS
See Also:
Constant Field Values

MAX_QUEUE_LENGTH

public static final int MAX_QUEUE_LENGTH
See Also:
Constant Field Values

DEFAULT_PORT_MIN

public static final int DEFAULT_PORT_MIN
See Also:
Constant Field Values

DEFAULT_PORT_MAX

public static final int DEFAULT_PORT_MAX
See Also:
Constant Field Values

maxMessageSize

public int maxMessageSize

listenSocket

protected java.net.ServerSocket listenSocket

address

protected Address address

connection_count

protected int connection_count

processing

protected boolean processing

context

private AgentContext context

buffer

private java.nio.ByteBuffer buffer

timeout

protected long timeout
timeout was originally private, but subclasses need to use it to construct there own treads of control, so I changed it to protected (ST -14/8/00)


inMail

protected Queue inMail
Data structure holding messages as they are read in


mbox

protected MailBox mbox
Reference to MailBox of which this is a sub-component


msgHandler

protected MsgHandler msgHandler

selector

java.nio.channels.Selector selector

server

java.nio.channels.ServerSocketChannel server

key

java.nio.channels.SelectionKey key

serverKey

java.nio.channels.SelectionKey serverKey

clients

private java.util.LinkedList clients

readSelector

private java.nio.channels.Selector readSelector

socket

java.net.ServerSocket socket
Constructor Detail

NIOServer

public NIOServer()

NIOServer

public NIOServer(AgentContext context,
                 MailBox mbox,
                 Queue inMail)
Method Detail

getAgentContext

public AgentContext getAgentContext()

updateCount

public void updateCount(int x)

stopProcessing

public void stopProcessing()

lowerStatus

public void lowerStatus()

normalStatus

public void normalStatus()

run

public void run()
Specified by:
run in interface java.lang.Runnable

serviceClients

public void serviceClients()
                    throws java.io.IOException
Throws:
java.io.IOException

registerClient

public void registerClient(java.nio.channels.SocketChannel client)
                    throws java.io.IOException
Throws:
java.io.IOException

finalize

protected void finalize()

getAddress

public Address getAddress()

newMsg

public void newMsg(Performative msg)
ensures that messages are processed // synchronized


getResponseAddress

public java.lang.String getResponseAddress()
implement in haste, repent at leisure

Specified by:
getResponseAddress in interface InTray

debug

public void debug(java.lang.String str)


Copyright © 2000-2003 BT Exact Technologies. All Rights Reserved.