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 voidaddCommandHandler(com.fishlib.net.api.CommandHandler handler)voidaddEventHandler(ControllerHashtableEventHandler handler)abstract voiddisconnect()abstract Map<Long,PersistentQueryInfo>getUnderlyingMap()voidremoveCommandHandler(com.fishlib.net.api.CommandHandler handler)voidremoveEventHandler(ControllerHashtableEventHandler handler)abstract voidsubscribeToAll()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.illumon.iris.controller.ControllerHashtableEventSource
addEventHandlerAndGetDataMethods 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:
addEventHandlerin interfaceControllerHashtableEventSource
-
removeEventHandler
- Specified by:
removeEventHandlerin interfaceControllerHashtableEventSource
-
addCommandHandler
public void addCommandHandler(com.fishlib.net.api.CommandHandler handler) -
removeCommandHandler
public void removeCommandHandler(com.fishlib.net.api.CommandHandler handler)
-