Class DistHashTable<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
edu.jas.util.DistHashTable<K,V>
- All Implemented Interfaces:
Map<K,V>
Distributed version of a HashTable. Implemented with a SortedMap / TreeMap to
keep the sequence order of elements.
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ChannelFactoryprotected SocketChannelprivate static final booleanprotected DHTListener<K, V> private static final org.apache.logging.log4j.Logger -
Constructor Summary
ConstructorsConstructorDescriptionDistHashTable(ChannelFactory cf, String host, int port) DistHashTable.DistHashTable.DistHashTable(String host) Constructs a new DistHashTable.DistHashTable(String host, int port) DistHashTable. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear the List.booleanContains key.booleanContains value.entrySet()Get the entries as Set.booleanEquals.Get value under key from DHT.getList()Get the internal sorted map.Get the internal list, convert from Collection.Get value under key from DHT.inthashCode()Hash code.voidinit()Initialize and start the list thread.booleanisEmpty()Is the List empty?iterator()List key iterator.keySet()Get the keys as set.Put object to the distributed hash table.voidPut object to the distributed hash table.intsize()Size of the (local) list.voidTerminate the list thread.List value iterator.values()Get the values as Collection.Methods inherited from class AbstractMap
clone, putAll, remove, toStringMethods inherited from interface Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
logger
private static final org.apache.logging.log4j.Logger logger -
debug
private static final boolean debug -
theList
-
cf
-
channel
-
listener
-
-
Constructor Details
-
DistHashTable
Constructs a new DistHashTable.- Parameters:
host- name or IP of server host.
-
DistHashTable
DistHashTable.- Parameters:
host- name or IP of server host.port- on server.
-
DistHashTable
DistHashTable.- Parameters:
cf- ChannelFactory to use.host- name or IP of server host.port- on server.
-
DistHashTable
-
-
Method Details
-
hashCode
-
equals
-
containsKey
Contains key.- Specified by:
containsKeyin interfaceMap<K,V> - Overrides:
containsKeyin classAbstractMap<K,V>
-
containsValue
Contains value.- Specified by:
containsValuein interfaceMap<K,V> - Overrides:
containsValuein classAbstractMap<K,V>
-
values
Get the values as Collection. -
keySet
-
entrySet
-
getValueList
-
getList
-
size
-
isEmpty
-
iterator
-
valueIterator
-
putWait
-
put
-
getWait
-
get
-
clear
-
init
public void init()Initialize and start the list thread. -
terminate
public void terminate()Terminate the list thread.
-