use of org.wildfly.clustering.ee.Mutator 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);
}
use of org.wildfly.clustering.ee.Mutator in project wildfly by wildfly.
the class CacheEntryMutatorTestCase method mutateNonTransactional.
@Test
public void mutateNonTransactional() {
AdvancedCache<Object, Object> cache = mock(AdvancedCache.class);
Object id = new Object();
Object value = new Object();
Configuration config = new ConfigurationBuilder().transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL).build();
when(cache.getCacheConfiguration()).thenReturn(config);
Mutator mutator = new CacheEntryMutator<>(cache, id, value);
when(cache.getAdvancedCache()).thenReturn(cache);
when(cache.withFlags(Flag.IGNORE_RETURN_VALUES, Flag.FAIL_SILENTLY)).thenReturn(cache);
mutator.mutate();
verify(cache).put(same(id), same(value));
mutator.mutate();
verify(cache, times(2)).put(same(id), same(value));
mutator.mutate();
verify(cache, times(3)).put(same(id), same(value));
}
use of org.wildfly.clustering.ee.Mutator in project wildfly by wildfly.
the class InfinispanBeanFactory method createBean.
@Override
public Bean<I, T> createBean(I id, BeanEntry<I> entry) {
I groupId = entry.getGroupId();
BeanGroupEntry<I, T> groupEntry = this.groupFactory.findValue(groupId);
if (groupEntry == null) {
InfinispanEjbLogger.ROOT_LOGGER.invalidBeanGroup(id, groupId);
this.cache.getAdvancedCache().withFlags(Flag.IGNORE_RETURN_VALUES).remove(this.createKey(id));
return null;
}
BeanGroup<I, T> group = this.groupFactory.createGroup(groupId, groupEntry);
Mutator mutator = (entry.getLastAccessedTime() == null) ? Mutator.PASSIVE : new CacheEntryMutator<>(this.cache, this.createKey(id), entry);
return new InfinispanBean<>(id, entry, group, mutator, this, this.timeout, this.listener);
}
Aggregations