Class HotRodSessionMetaDataFactory<C>
java.lang.Object
org.wildfly.clustering.session.infinispan.remote.metadata.HotRodSessionMetaDataFactory<C>
- Type Parameters:
C- the local context type
- All Implemented Interfaces:
AutoCloseable, BiFunction<SessionCreationMetaDataEntry<C>, SessionAccessMetaDataEntry, SessionMetaDataEntry<C>>, CacheEntryCreator<String, SessionMetaDataEntry<C>, Map.Entry<Instant, Optional<Duration>>>, CacheEntryLocator<String, SessionMetaDataEntry<C>>, CacheEntryRemover<String>, BiFunction<SessionCreationMetaDataEntry<C>, SessionAccessMetaDataEntry, SessionMetaDataEntry<C>>, ImmutableSessionMetaDataFactory<SessionMetaDataEntry<C>>, SessionMetaDataFactory<SessionMetaDataEntry<C>>
public class HotRodSessionMetaDataFactory<C>
extends Object
implements SessionMetaDataFactory<SessionMetaDataEntry<C>>, BiFunction<SessionCreationMetaDataEntry<C>, SessionAccessMetaDataEntry, SessionMetaDataEntry<C>>
Factory for creating
SessionMetaData backed by a pair of RemoteCache entries.- Author:
- Paul Ferraro
-
Field Summary
Fields inherited from interface BiFunction
FORMER_IDENTITY, LATTER_IDENTITY, NULL -
Constructor Summary
ConstructorsConstructorDescriptionHotRodSessionMetaDataFactory(RemoteCacheConfiguration configuration) Creates a session metadata factory. -
Method Summary
Modifier and TypeMethodDescriptionapply(SessionCreationMetaDataEntry<C> creationMetaData, SessionAccessMetaDataEntry accessMetaData) voidclose()createImmutableSessionMetaData(String id, SessionMetaDataEntry<C> entry) Creates immutable session metadata for the specified identifier and cache entry.createSessionMetaData(String id, SessionMetaDataEntry<C> entry) Creates invalidatable session metadata from the specified identifier and cache value.Creates a value in the cache, if it does not already exist.findValueAsync(String id) Locates the value in the cache with the specified identifier.removeAsync(String id) Removes the specified entry from the cache.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BiFunction
andThen, compose, composeUnary, orDefault, reverse, withDefaultMethods inherited from interface CacheEntryCreator
createValueMethods inherited from interface CacheEntryLocator
findValue, tryValue, tryValueAsyncMethods inherited from interface CacheEntryRemover
purge, purgeAsync, remove
-
Constructor Details
-
HotRodSessionMetaDataFactory
Creates a session metadata factory.- Parameters:
configuration- the configuration of the associated cache
-
-
Method Details
-
createValueAsync
public CompletionStage<SessionMetaDataEntry<C>> createValueAsync(String id, Map.Entry<Instant, Optional<Duration>> context) Description copied from interface:CacheEntryCreatorCreates a value in the cache, if it does not already exist.- Specified by:
createValueAsyncin interfaceCacheEntryCreator<String, SessionMetaDataEntry<C>, Map.Entry<Instant, Optional<Duration>>>- Parameters:
id- the cache entry identifier.context- the context of the created value- Returns:
- the new value, or the existing value the cache entry already exists.
-
findValueAsync
Description copied from interface:CacheEntryLocatorLocates the value in the cache with the specified identifier.- Specified by:
findValueAsyncin interfaceCacheEntryLocator<String, SessionMetaDataEntry<C>>- Parameters:
id- the cache entry identifier- Returns:
- the value of the cache entry, or null if not found.
-
apply
public SessionMetaDataEntry<C> apply(SessionCreationMetaDataEntry<C> creationMetaData, SessionAccessMetaDataEntry accessMetaData) - Specified by:
applyin interfaceBiFunction<SessionCreationMetaDataEntry<C>, SessionAccessMetaDataEntry, SessionMetaDataEntry<C>>
-
removeAsync
Description copied from interface:CacheEntryRemoverRemoves the specified entry from the cache.- Specified by:
removeAsyncin interfaceCacheEntryRemover<C>- Parameters:
id- the cache entry identifier.- Returns:
- true, if the entry was removed.
-
createSessionMetaData
Description copied from interface:SessionMetaDataFactoryCreates invalidatable session metadata from the specified identifier and cache value.- Specified by:
createSessionMetaDatain interfaceSessionMetaDataFactory<C>- Parameters:
id- the identifier of a sessionentry- the cache value of the session- Returns:
- invalidatable session metadata from the specified identifier and cache value.
-
createImmutableSessionMetaData
public ImmutableSessionMetaData createImmutableSessionMetaData(String id, SessionMetaDataEntry<C> entry) Description copied from interface:ImmutableSessionMetaDataFactoryCreates immutable session metadata for the specified identifier and cache entry.- Specified by:
createImmutableSessionMetaDatain interfaceImmutableSessionMetaDataFactory<C>- Parameters:
id- the identifier of a sessionentry- the cache value of the session- Returns:
- immutable session metadata for the specified identifier and cache entry.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceSessionMetaDataFactory<C>
-