edu.jas.util
Class DistHashTableServer<K>

java.lang.Object
  extended by java.lang.Thread
      extended by edu.jas.util.DistHashTableServer<K>
All Implemented Interfaces:
java.lang.Runnable

public class DistHashTableServer<K>
extends java.lang.Thread

Server for the distributed version of a list.

Author:
Heinz Kredel
To do
redistribute list for late comming clients, removal of elements.

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  ChannelFactory cf
           
static int DEFAULT_PORT
           
protected  java.util.List<edu.jas.util.DHTBroadcaster<K>> servers
           
protected  java.util.SortedMap<K,DHTTransport> theList
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
DistHashTableServer()
          Constructs a new DistHashTableServer.
DistHashTableServer(ChannelFactory cf)
          DistHashTableServer.
DistHashTableServer(int port)
          DistHashTableServer.
 
Method Summary
 void init()
          thread initialization and start.
static void main(java.lang.String[] args)
          main.
 void run()
          main server method.
 int size()
          number of servers.
 void terminate()
          terminate all servers.
 java.lang.String toString()
          toString.
 
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, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_PORT

public static final int DEFAULT_PORT
See Also:
Constant Field Values

cf

protected final ChannelFactory cf

servers

protected java.util.List<edu.jas.util.DHTBroadcaster<K>> servers

theList

protected final java.util.SortedMap<K,DHTTransport> theList
Constructor Detail

DistHashTableServer

public DistHashTableServer()
Constructs a new DistHashTableServer.


DistHashTableServer

public DistHashTableServer(int port)
DistHashTableServer.

Parameters:
port - to run server on.

DistHashTableServer

public DistHashTableServer(ChannelFactory cf)
DistHashTableServer.

Parameters:
cf - ChannelFactory to use.
Method Detail

main

public static void main(java.lang.String[] args)
main. Usage: DistHashTableServer <port>


init

public void init()
thread initialization and start.


run

public void run()
main server method.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

terminate

public void terminate()
terminate all servers.


size

public int size()
number of servers.


toString

public java.lang.String toString()
toString.

Overrides:
toString in class java.lang.Thread
Returns:
a string representation of this.