Class ChannelCache<K,C extends Channel,A>
java.lang.Object
org.jdrupes.vmoperator.manager.events.ChannelCache<K,C,A>
- Type Parameters:
K
- the key typeC
- the channel typeA
- the type of the associated data
A channel manager that tracks mappings from a key to a channel using
“add/remove” (or “open/close”) events and the channels on which they
are delivered.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
ChannelCache.Both<C extends Channel,
A> Combines the channel and the associated data. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionChannelCache
<K, C, A> Associate the entry for the channel with the given data.Returns all associated data.associated
(K key) Return the data associated with the entry for the channel.Returns the channel and associates data registered for the key or an empty optional if no mapping exists.Returns the channel registered for the key or an empty optional if no mapping exists.keys()
Returns all known keys.ChannelCache
<K, C, A> Store the given data.ChannelCache
<K, C, A> Store the given data.void
Removes the channel with the given name.
-
Constructor Details
-
ChannelCache
public ChannelCache()
-
-
Method Details
-
both
Returns the channel and associates data registered for the key or an empty optional if no mapping exists.- Parameters:
key
- the key- Returns:
- the result
-
put
Store the given data.- Parameters:
key
- the keychannel
- the channelassociated
- the associated- Returns:
- the channel manager
-
put
Store the given data.- Parameters:
key
- the keychannel
- the channel- Returns:
- the channel manager
-
channel
Returns the channel registered for the key or an empty optional if no mapping exists.- Parameters:
key
- the key- Returns:
- the optional
-
associate
Associate the entry for the channel with the given data.The entry for the channel must already exist.
- Parameters:
key
- the keydata
- the data- Returns:
- the channel manager
-
associated
Return the data associated with the entry for the channel.- Parameters:
key
- the key- Returns:
- the data
-
associated
Returns all associated data.- Returns:
- the collection
-
remove
Removes the channel with the given name.- Parameters:
name
- the name
-
keys
Returns all known keys.- Returns:
- the sets the
-