use of org.wildfly.clustering.ee.infinispan.CacheEntryMutator in project wildfly by wildfly.
the class CoarseSessionAttributesFactory method createSessionAttributes.
@Override
public SessionAttributes createSessionAttributes(String id, Map.Entry<Map<String, Object>, V> entry) {
SessionAttributesKey key = new SessionAttributesKey(id);
Mutator mutator = this.properties.isTransactional() && this.cache.getAdvancedCache().getCacheEntry(key).isCreated() ? Mutator.PASSIVE : new CacheEntryMutator<>(this.cache, key, entry.getValue());
return new CoarseSessionAttributes(entry.getKey(), mutator, this.marshaller, this.properties);
}
use of org.wildfly.clustering.ee.infinispan.CacheEntryMutator in project wildfly by wildfly.
the class CoarseSessionsFactory method createSessions.
@Override
public Sessions<D, S> createSessions(String ssoId, Map<D, S> value) {
CoarseSessionsKey key = new CoarseSessionsKey(ssoId);
Mutator mutator = new CacheEntryMutator<>(this.cache, key, value);
return new CoarseSessions<>(value, mutator);
}
use of org.wildfly.clustering.ee.infinispan.CacheEntryMutator in project wildfly by wildfly.
the class InfinispanSessionMetaDataFactory method createSessionMetaData.
@Override
public InvalidatableSessionMetaData createSessionMetaData(String id, InfinispanSessionMetaData<L> entry) {
SessionCreationMetaDataKey creationMetaDataKey = new SessionCreationMetaDataKey(id);
Mutator creationMutator = this.properties.isTransactional() && this.creationMetaDataCache.getAdvancedCache().getCacheEntry(creationMetaDataKey).isCreated() ? Mutator.PASSIVE : new CacheEntryMutator<>(this.creationMetaDataCache, creationMetaDataKey, new SessionCreationMetaDataEntry<>(entry.getCreationMetaData(), entry.getLocalContext()));
SessionCreationMetaData creationMetaData = new MutableSessionCreationMetaData(entry.getCreationMetaData(), creationMutator);
SessionAccessMetaDataKey accessMetaDataKey = new SessionAccessMetaDataKey(id);
Mutator accessMutator = this.properties.isTransactional() && this.accessMetaDataCache.getAdvancedCache().getCacheEntry(accessMetaDataKey).isCreated() ? Mutator.PASSIVE : new CacheEntryMutator<>(this.accessMetaDataCache, accessMetaDataKey, entry.getAccessMetaData());
SessionAccessMetaData accessMetaData = new MutableSessionAccessMetaData(entry.getAccessMetaData(), accessMutator);
return new SimpleSessionMetaData(creationMetaData, accessMetaData);
}
use of org.wildfly.clustering.ee.infinispan.CacheEntryMutator in project wildfly by wildfly.
the class FineSessionAttributes method getAttribute.
@Override
public Object getAttribute(String name) {
Integer attributeId = this.names.get(name);
if (attributeId == null)
return null;
SessionAttributeKey key = this.createKey(attributeId);
V value = this.cache.get(key);
Object attribute = this.read(name, value);
if (attribute != null) {
// If the object is mutable, we need to indicate that the attribute should be replicated
if (!SessionAttributeImmutability.INSTANCE.test(attribute)) {
Mutator mutator = this.mutations.computeIfAbsent(name, k -> new CacheEntryMutator<>(this.cache, key, value));
// If cache is not transactional, mutate on close instead.
if (this.properties.isTransactional()) {
mutator.mutate();
}
}
}
return attribute;
}
use of org.wildfly.clustering.ee.infinispan.CacheEntryMutator in project wildfly by wildfly.
the class FineSessionAttributesFactory method createSessionAttributes.
@Override
public SessionAttributes createSessionAttributes(String id, SessionAttributeNamesEntry entry) {
SessionAttributeNamesKey key = new SessionAttributeNamesKey(id);
Mutator mutator = this.properties.isTransactional() && this.namesCache.getAdvancedCache().getCacheEntry(key).isCreated() ? Mutator.PASSIVE : new CacheEntryMutator<>(this.namesCache, key, entry);
return new FineSessionAttributes<>(id, entry.getSequence(), entry.getNames(), mutator, this.attributeCache, this.marshaller, this.properties);
}
Aggregations