Package edu.jas.util

Class DistributedList

java.lang.Object
edu.jas.util.DistributedList

public class DistributedList extends Object
Distributed version of a List. Implemented with a SortedMap / TreeMap to keep the sequence order of elements.
  • Field Details

  • Constructor Details

    • DistributedList

      public DistributedList(String host)
      Constructor for DistributedList.
      Parameters:
      host - name or IP of server host.
    • DistributedList

      public DistributedList(String host, int port)
      Constructor for DistributedList.
      Parameters:
      host - name or IP of server host.
      port - of server.
    • DistributedList

      public DistributedList(ChannelFactory cf, String host, int port)
      Constructor for DistributedList.
      Parameters:
      cf - ChannelFactory to use.
      host - name or IP of server host.
      port - of server.
    • DistributedList

      public DistributedList(SocketChannel sc)
      Constructor for DistributedList.
      Parameters:
      sc - SocketChannel to use.
  • Method Details

    • init

      public void init()
      List thread initialization and start.
    • terminate

      public void terminate()
      Terminate the list thread.
    • getList

      public List<Object> getList()
      Get the internal list, convert from Collection.
    • size

      public int size()
      Size of the (local) list.
    • add

      public void add(Object o)
      Add object to the list and distribute to other lists. Blocks until the object is send and received from the server (actually it blocks until some object is received).
      Parameters:
      o -
    • clear

      public void clear()
      Clear the List. caveat: must be called on all clients.
    • isEmpty

      public boolean isEmpty()
      Is the List empty?
    • iterator

      public Iterator iterator()
      List iterator.