Package edu.jas.util
Class DistributedList
java.lang.Object
edu.jas.util.DistributedList
Distributed version of a List.
Implemented with a SortedMap / TreeMap to keep the sequence order of elements.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDistributedList
(ChannelFactory cf, String host, int port) Constructor for DistributedList.Constructor for DistributedList.DistributedList
(String host) Constructor for DistributedList.DistributedList
(String host, int port) Constructor for DistributedList. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add object to the list and distribute to other lists.void
clear()
Clear the List.getList()
Get the internal list, convert from Collection.void
init()
List thread initialization and start.boolean
isEmpty()
Is the List empty?iterator()
List iterator.int
size()
Size of the (local) list.void
Terminate the list thread.
-
Field Details
-
logger
private static final org.apache.logging.log4j.Logger logger -
theList
-
cf
-
channel
-
listener
-
-
Constructor Details
-
DistributedList
Constructor for DistributedList.- Parameters:
host
- name or IP of server host.
-
DistributedList
Constructor for DistributedList.- Parameters:
host
- name or IP of server host.port
- of server.
-
DistributedList
Constructor for DistributedList.- Parameters:
cf
- ChannelFactory to use.host
- name or IP of server host.port
- of server.
-
DistributedList
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
Get the internal list, convert from Collection. -
size
public int size()Size of the (local) list. -
add
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
List iterator.
-