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) Creates a session attributes factory -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()createImmutableSessionAttributes(String id, Map<String, Object> attributes) Creates an immutable session attributes.createSessionAttributes(String id, Map<String, Object> attributes, ImmutableSessionMetaData metaData, C context) Create aSessionAttributesobject.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 Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface CacheEntryLocator
findValue, tryValueMethods inherited from interface CacheEntryRemover
purge, purgeAsync, remove
-
Constructor Details
-
FineSessionAttributesFactory
public FineSessionAttributesFactory(SessionAttributesFactoryConfiguration<Object, V> configuration, BiFunction<ImmutableSession, C, SessionAttributeActivationNotifier> notifierFactory, RemoteCacheConfiguration hotrod) Creates a session attributes factory- Parameters:
configuration- the configuration of this factorynotifierFactory- a session attribute activation/passivation notifier factoryhotrod- the configuration of the associated cache
-
-
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) Description copied from interface:SessionAttributesFactoryCreate aSessionAttributesobject.- Specified by:
createSessionAttributesin interfaceSessionAttributesFactory<C,V> - Parameters:
id- the identifier of a sessionattributes- the marshalled value typemetaData- the metadata of a sessioncontext- the context of a session- Returns:
- a
SessionAttributesobject.
-
createImmutableSessionAttributes
public Map<String,Object> createImmutableSessionAttributes(String id, Map<String, Object> attributes) Description copied from interface:ImmutableSessionAttributesFactoryCreates an immutable session attributes.- Specified by:
createImmutableSessionAttributesin interfaceImmutableSessionAttributesFactory<C>- Parameters:
id- the identifier of a sessionattributes- the session attributes cache entry- Returns:
- a map of session attributes
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceSessionAttributesFactory<C,V>
-