Package edu.jas.util

Class DistHashTableServer<K>

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

public class DistHashTableServer<K> extends Thread
Server for the distributed version of a list. TODO: redistribute list for late coming clients, removal of elements.
  • Field Details

    • 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:
    • cf

      protected final ChannelFactory cf
    • servers

      protected List<DHTBroadcaster<K>> servers
    • goon

      private volatile boolean goon
    • mythread

      private volatile Thread mythread
    • theList

      protected final SortedMap<K,DHTTransport> theList
    • etime

      private long etime
    • dtime

      private long dtime
    • ertime

      private long ertime
    • drtime

      private long drtime
  • Constructor Details

    • 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 Details

    • main

      public static void main(String[] args) throws InterruptedException
      main. Usage: DistHashTableServer <port>
      Throws:
      InterruptedException
    • init

      public void init()
      thread initialization and start.
    • run

      public void run()
      main server method.
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
    • terminate

      public void terminate()
      terminate all servers.
    • size

      public int size()
      number of servers.
    • toString

      public String toString()
      toString.
      Overrides:
      toString in class Thread
      Returns:
      a string representation of this.