Package com.illumon.iris.controller
Class ControllerHashtable
java.lang.Object
com.illumon.iris.controller.ControllerHashtable
- All Implemented Interfaces:
ControllerHashtableEventSource
,Map<Long,PersistentQueryInfo>
- Direct Known Subclasses:
ControllerHashtableClient
,ControllerHashtableServer
public abstract class ControllerHashtable extends Object implements Map<Long,PersistentQueryInfo>, ControllerHashtableEventSource
This class provides a base for a Controller hash table.
The server maintains the authoritative version of the map. Clients can connect to the server and listen to the updates to which they subscribe. Clients can also send the server their update requests, via a separate Comm channel.
Threading rules:
- All methods are already appropriately synchronized, so you do not need any further synchronization for most tasks.
- To gain exclusive access to the data (for example, while
iterating over the entries in the map), synchronize on the object
returned by
getUnderlyingMap()
. - The ControllerHashtable itself is not the lock for the map data!
-
Nested Class Summary
-
Field Summary
-
Method Summary
Modifier and Type Method Description void
addCommandHandler(com.fishlib.net.api.CommandHandler handler)
void
addEventHandler(ControllerHashtableEventHandler handler)
abstract void
disconnect()
abstract Map<Long,PersistentQueryInfo>
getUnderlyingMap()
void
removeCommandHandler(com.fishlib.net.api.CommandHandler handler)
void
removeEventHandler(ControllerHashtableEventHandler handler)
abstract void
subscribeToAll()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.illumon.iris.controller.ControllerHashtableEventSource
addEventHandlerAndGetData
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Field Details
-
id
The identifier of this hashtable.
-
-
Method Details
-
disconnect
- Throws:
IOException
-
subscribeToAll
- Throws:
IOException
-
getUnderlyingMap
-
addEventHandler
- Specified by:
addEventHandler
in interfaceControllerHashtableEventSource
-
removeEventHandler
- Specified by:
removeEventHandler
in interfaceControllerHashtableEventSource
-
addCommandHandler
public void addCommandHandler(com.fishlib.net.api.CommandHandler handler) -
removeCommandHandler
public void removeCommandHandler(com.fishlib.net.api.CommandHandler handler)
-