dk.itu.smds.torusman
Class ServerListener

java.lang.Object
  extended by java.lang.Thread
      extended by dk.itu.smds.torusman.ServerListener
All Implemented Interfaces:
java.lang.Runnable

public class ServerListener
extends java.lang.Thread

The listener interface for receiving server events. The class that is interested in processing a server event implements this interface, and the object created with that class is registered with a component using the component's addServerListener method. When the server event occurs, that object's appropriate method is invoked.

See Also:
ServerEvent

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 java.io.DataInputStream[] ins
          The ins.
 int latestAdd
          The latest add.
 LocalTorus lt
          The lt.
 ServerSender sender
          The sender.
 ServerTime time
          The time.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ServerListener(int size, ServerSender s)
          Instantiates a new server listener.
 
Method Summary
 void addListener(java.io.DataInputStream in, ServerTime time)
          Adds the listener.
 void run()
          Listens for packages on all connections to the clients and passes them to the sender.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ins

public java.io.DataInputStream[] ins
The ins.


latestAdd

public volatile int latestAdd
The latest add.


sender

public ServerSender sender
The sender.


time

public ServerTime time
The time.


lt

public LocalTorus lt
The lt.

Constructor Detail

ServerListener

public ServerListener(int size,
                      ServerSender s)
Instantiates a new server listener.

Parameters:
size - the size
s - the s
Method Detail

addListener

public void addListener(java.io.DataInputStream in,
                        ServerTime time)
Adds the listener.

Parameters:
in - the in
time - the time

run

public void run()
Listens for packages on all connections to the clients and passes them to the sender.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread
See Also:
Thread.run()