Class FineSessionAttributesFactory<C,V>
java.lang.Object
org.wildfly.clustering.session.infinispan.remote.attributes.FineSessionAttributesFactory<C,V>
- Type Parameters:
C- the session manager context typeV- the cache value type
- All Implemented Interfaces:
AutoCloseable,CacheEntryCreator<String,,Map<String, Object>, Void> CacheEntryLocator<String,,Map<String, Object>> CacheEntryRemover<String>,ImmutableSessionAttributesFactory<Map<String,,Object>> SessionAttributesFactory<C,Map<String, Object>>
public class FineSessionAttributesFactory<C,V>
extends Object
implements SessionAttributesFactory<C,Map<String,Object>>
SessionAttributesFactory for fine granularity sessions, where all session attributes are stored in a single cache entry,
but changes are applied by functions such that only modified and mutated values ever replicate/persist.
This implementation is unsuited for attributes that strongly reference each other.- Author:
- Paul Ferraro
-
Constructor Summary
ConstructorsConstructorDescriptionFineSessionAttributesFactory(SessionAttributesFactoryConfiguration<Object, V> configuration, BiFunction<ImmutableSession, C, SessionAttributeActivationNotifier> notifierFactory, RemoteCacheConfiguration hotrod) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()createImmutableSessionAttributes(String id, Map<String, Object> attributes) createSessionAttributes(String id, Map<String, Object> attributes, ImmutableSessionMetaData metaData, C context) createValue(String id, Void context) Creates a value in the cache, if it does not already exist.createValueAsync(String id, Void context) 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.tryValueAsync(String id) Returns the value for the specified key, if possible without contention.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.wildfly.clustering.cache.CacheEntryLocator
findValue, tryValueMethods inherited from interface org.wildfly.clustering.cache.CacheEntryRemover
purge, purgeAsync, remove
-
Constructor Details
-
FineSessionAttributesFactory
public FineSessionAttributesFactory(SessionAttributesFactoryConfiguration<Object, V> configuration, BiFunction<ImmutableSession, C, SessionAttributeActivationNotifier> notifierFactory, RemoteCacheConfiguration hotrod)
-
-
Method Details
-
createValue
Description copied from interface:CacheEntryCreatorCreates a value in the cache, if it does not already exist.- Specified by:
createValuein interfaceCacheEntryCreator<String,Map<String, Object>, Void> - 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.
-
createValueAsync
Description copied from interface:CacheEntryCreatorCreates a value in the cache, if it does not already exist.- Specified by:
createValueAsyncin interfaceCacheEntryCreator<String,Map<String, Object>, Void> - 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<C,V> - Parameters:
id- the cache entry identifier- Returns:
- the value of the cache entry, or null if not found.
-
tryValueAsync
Description copied from interface:CacheEntryLocatorReturns the value for the specified key, if possible without contention.- Specified by:
tryValueAsyncin interfaceCacheEntryLocator<C,V> - Parameters:
id- a logical key- Returns:
- the value of the cache entry, or null if not found or unavailable.
-
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.
-
createSessionAttributes
public SessionAttributes createSessionAttributes(String id, Map<String, Object> attributes, ImmutableSessionMetaData metaData, C context) - Specified by:
createSessionAttributesin interfaceSessionAttributesFactory<C,V>
-
createImmutableSessionAttributes
public Map<String,Object> createImmutableSessionAttributes(String id, Map<String, Object> attributes) - Specified by:
createImmutableSessionAttributesin interfaceImmutableSessionAttributesFactory<C>
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceSessionAttributesFactory<C,V>
-