Interface LocalSpace<K,V>
- Type Parameters:
K- the key typeV- the value type
- All Superinterfaces:
AutoCloseable, Space<K,V>
Extension of
Space with blocking read/take operations and space-listener support.-
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(K key, SpaceListener<K, V> listener) add a SpaceListener associated with a given keyvoidaddListener(K key, SpaceListener<K, V> listener, long timeout) add a SpaceListener associated with a given key for a given period of time.Returns the set of all keys currently present in the space.voidremoveListener(K key, SpaceListener<K, V> listener) removes a SpaceListener associated with a given keyintReturns the number of entries queued under the given key.Methods inherited from interface Space
close, existAny, existAny, in, in, inp, nrd, nrd, out, out, push, push, put, put, rd, rd, rdpModifier and TypeMethodDescriptiondefault voidclose()booleanReturns true if any of the given keys are present in the space.booleanReturns true if any of the given keys become available within the timeout.Take an entry from the space, waiting forever until one exists.Take an entry from the space, waiting a limited amount of time until one exists.In probe takes an entry from the space if one exists, return null otherwise.voidNrd (not read) waits forever until Key is not present in space.
Resolution for expiring entries is implementation dependant, but a minimum one-second is suggested.Nrd (not read) waits up to timeout until Key is not present in space.
Resolution for expiring entries is implementation dependant, but a minimum one-second is suggested.voidWrite a new entry into the SpacevoidWrite a new entry into the Space, with an timeout valuevoidWrite a new entry at the head of a queue.voidWrite a new entry at the head of the queue with a timeout valuevoidWrite a single entry at the head of the queue discarding the other entriesvoidWrite a single entry at the head of the queue discarding the other entries, with timeout.Read an entry from the space, waiting forever until one exists.Read an entry from the space, waiting a limited amount of time until one exists.Read probe reads an entry from the space if one exists, return null otherwise.
-
Method Details
-
addListener
add a SpaceListener associated with a given key- Parameters:
key- Entry's keylistener- a SpaceListener
-
addListener
add a SpaceListener associated with a given key for a given period of time. Warning: not supported by all space implementations.- Parameters:
key- Entry's keylistener- a SpaceListenertimeout- listener registration timeout in millis
-
removeListener
removes a SpaceListener associated with a given key- Parameters:
key- Entry's keylistener- the SpaceListener
-
getKeySet
-
size
-