Refine search
@Override public void mutate() { // We only ever have to perform a replace once within a batch if ((this.mutated == null) || this.mutated.compareAndSet(false, true)) { // Use FAIL_SILENTLY to prevent mutation from failing locally due to remote exceptions this.cache.getAdvancedCache().withFlags(Flag.IGNORE_RETURN_VALUES, Flag.FAIL_SILENTLY).put(this.id, this.value); } } }
@Override public InfinispanSessionMetaData<L> createValue(String id, Void context) { SessionCreationMetaDataEntry<L> creationMetaDataEntry = new SessionCreationMetaDataEntry<>(new SimpleSessionCreationMetaData()); if (this.creationMetaDataCache.getAdvancedCache().withFlags(Flag.FORCE_SYNCHRONOUS).putIfAbsent(new SessionCreationMetaDataKey(id), creationMetaDataEntry) != null) { return null; } SessionAccessMetaData accessMetaData = new SimpleSessionAccessMetaData(); this.accessMetaDataCache.getAdvancedCache().withFlags(Flag.IGNORE_RETURN_VALUES).put(new SessionAccessMetaDataKey(id), accessMetaData); return new InfinispanSessionMetaData<>(creationMetaDataEntry.getMetaData(), accessMetaData, creationMetaDataEntry.getLocalContext()); }
@Override public Map.Entry<Map<String, Object>, V> createValue(String id, Void context) { Map<String, Object> attributes = this.properties.isLockOnRead() ? new HashMap<>() : new ConcurrentHashMap<>(); V value = this.marshaller.write(attributes); this.cache.getAdvancedCache().withFlags(Flag.IGNORE_RETURN_VALUES).put(new SessionAttributesKey(id), value); return new SimpleImmutableEntry<>(attributes, value); }
@Override public Map.Entry<Map.Entry<A, AtomicReference<L>>, SV> createValue(String id, A authentication) { AuthenticationEntry<AV, L> entry = new AuthenticationEntry<>(this.marshaller.write(authentication)); this.cache.getAdvancedCache().withFlags(Flag.IGNORE_RETURN_VALUES).put(new AuthenticationKey(id), entry); SV sessions = this.sessionsFactory.createValue(id, null); return new AbstractMap.SimpleImmutableEntry<>(new AbstractMap.SimpleImmutableEntry<>(authentication, entry.getLocalContext()), sessions); }
@Override public Object setAttribute(String name, Object attribute) { if (attribute == null) { return this.removeAttribute(name); } if (this.properties.isMarshalling() && !this.marshaller.isMarshallable(attribute)) { throw new IllegalArgumentException(new NotSerializableException(attribute.getClass().getName())); } V value = this.marshaller.write(attribute); UUID attributeId = this.names.get(name); if (attributeId == null) { UUID newAttributeId = UUID.randomUUID(); this.setNames(this.namesCache.getAdvancedCache().withFlags(Flag.FORCE_SYNCHRONOUS).compute(this.createKey(), this.properties.isTransactional() ? new CopyOnWriteMapPutFunction<>(name, newAttributeId) : new ConcurrentMapPutFunction<>(name, newAttributeId))); attributeId = this.names.get(name); } Object result = this.read(name, this.attributeCache.getAdvancedCache().withFlags(Flag.FORCE_SYNCHRONOUS).put(this.createKey(attributeId), value)); this.mutations.remove(name); return result; }
@Override public void mutate() { // We only ever have to perform a replace once within a batch if ((this.mutated == null) || this.mutated.compareAndSet(false, true)) { // Use FAIL_SILENTLY to prevent mutation from failing locally due to remote exceptions this.cache.getAdvancedCache().withFlags(Flag.IGNORE_RETURN_VALUES, Flag.FAIL_SILENTLY).put(this.id, this.value); } } }
@Override public void mutate() { // We only ever have to perform a replace once within a batch if ((this.mutated == null) || this.mutated.compareAndSet(false, true)) { // Use FAIL_SILENTLY to prevent mutation from failing locally due to remote exceptions this.cache.getAdvancedCache().withFlags(Flag.IGNORE_RETURN_VALUES, Flag.FAIL_SILENTLY).put(this.id, this.value); } } }
@Override public void run() { // Save this synchronously to ensure all nodes read correct state // We ignore cacheStore for now, so that in Cross-DC scenario (with RemoteStore enabled) is the remoteStore ignored. BaseCacheInitializer.this.workCache.getAdvancedCache(). withFlags(Flag.IGNORE_RETURN_VALUES, Flag.FORCE_SYNCHRONOUS, Flag.SKIP_CACHE_STORE, Flag.SKIP_CACHE_LOAD) .put(stateKey, state); }
public void testSkipLockingAfterPutWithTm(Method m) { EmbeddedCacheManager cacheManager = TestCacheManagerFactory.createCacheManager(true); try { AdvancedCache advancedCache = cacheManager.getCache().getAdvancedCache(); String name = m.getName(); advancedCache.put("k-" + name, "v-" + name); advancedCache.withFlags(Flag.SKIP_LOCKING).put("k-" + name, "v2-" + name); } finally { cacheManager.stop(); } }
public void testLocalOnlyClear() { AdvancedCache<String, String> cache1 = advancedCache(0,"invalidation"); AdvancedCache<String, String> cache2 = advancedCache(1,"invalidation"); cache1.withFlags(CACHE_MODE_LOCAL).put("key", "value1"); cache2.withFlags(CACHE_MODE_LOCAL).put("key", "value2"); assert cache1.get("key").equals("value1"); assert cache2.get("key").equals("value2"); cache1.withFlags(CACHE_MODE_LOCAL).clear(); assert cache1.get("key") == null; assert cache2.get("key") != null; assert cache2.get("key").equals("value2"); }