Package edu.jas.util
Class DistHashTableServer<K>
- java.lang.Object
-
- java.lang.Thread
-
- 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. TODO: redistribute list for late coming clients, removal of elements.
-
-
Field Summary
Fields Modifier and Type Field Description protected ChannelFactory
cf
private static boolean
debug
static int
DEFAULT_PORT
private long
drtime
private long
dtime
private long
ertime
private long
etime
private boolean
goon
private static org.apache.logging.log4j.Logger
logger
private java.lang.Thread
mythread
protected java.util.List<DHTBroadcaster<K>>
servers
protected java.util.SortedMap<K,DHTTransport>
theList
-
Constructor Summary
Constructors Constructor Description DistHashTableServer()
Constructs a new DistHashTableServer.DistHashTableServer(int port)
DistHashTableServer.DistHashTableServer(ChannelFactory cf)
DistHashTableServer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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, clone, 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
-
-
-
-
Field Detail
-
logger
private static final org.apache.logging.log4j.Logger logger
-
debug
private static final boolean debug
-
DEFAULT_PORT
public static final int DEFAULT_PORT
- See Also:
- Constant Field Values
-
cf
protected final ChannelFactory cf
-
servers
protected java.util.List<DHTBroadcaster<K>> servers
-
goon
private volatile boolean goon
-
mythread
private volatile java.lang.Thread mythread
-
theList
protected final java.util.SortedMap<K,DHTTransport> theList
-
etime
private long etime
-
dtime
private long dtime
-
ertime
private long ertime
-
drtime
private long drtime
-
-
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) throws java.lang.InterruptedException
main. Usage: DistHashTableServer <port>- Throws:
java.lang.InterruptedException
-
init
public void init()
thread initialization and start.
-
run
public void run()
main server method.- Specified by:
run
in interfacejava.lang.Runnable
- Overrides:
run
in classjava.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 classjava.lang.Thread
- Returns:
- a string representation of this.
-
-