Package edu.jas.util
Class DistributedListServer
- java.lang.Object
-
- java.lang.Thread
-
- edu.jas.util.DistributedListServer
-
- All Implemented Interfaces:
java.lang.Runnable
public class DistributedListServer extends java.lang.Thread
Server for the distributed version of a list.- Author:
- Heinz Kredel TODO: redistribute list for late comming clients, removal of elements.
-
-
Field Summary
Fields Modifier and Type Field Description protected ChannelFactorycfstatic intDEFAULT_PORTprotected java.util.List<edu.jas.util.Broadcaster>serversprotected java.util.SortedMap<edu.jas.util.Counter,java.lang.Object>theList
-
Constructor Summary
Constructors Constructor Description DistributedListServer()Constructs a new DistributedListServer.DistributedListServer(int port)DistributedListServer.DistributedListServer(ChannelFactory cf)DistributedListServer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinit()thread initialization and start.static voidmain(java.lang.String[] args)main.voidrun()main server method.intsize()number of servers.voidterminate()terminate all servers.-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
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.Broadcaster> servers
-
theList
protected final java.util.SortedMap<edu.jas.util.Counter,java.lang.Object> theList
-
-
Constructor Detail
-
DistributedListServer
public DistributedListServer()
Constructs a new DistributedListServer.
-
DistributedListServer
public DistributedListServer(int port)
DistributedListServer.- Parameters:
port- to run server on.
-
DistributedListServer
public DistributedListServer(ChannelFactory cf)
DistributedListServer.- Parameters:
cf- ChannelFactory to use.
-
-
Method Detail
-
main
public static void main(java.lang.String[] args) throws java.lang.InterruptedException
main. Usage: DistributedListServer <port>- Throws:
java.lang.InterruptedException
-
init
public void init()
thread initialization and start.
-
run
public void run()
main server method.- Specified by:
runin interfacejava.lang.Runnable- Overrides:
runin classjava.lang.Thread
-
terminate
public void terminate()
terminate all servers.
-
size
public int size()
number of servers.
-
-