Exemplo n.º 1
0
 @Override
 public void notifyCacheEntryInvalidated(
     final K key, V value, final boolean pre, InvocationContext ctx, FlagAffectedCommand command) {
   if (isNotificationAllowed(command, cacheEntryInvalidatedListeners)) {
     EventImpl<K, V> e = EventImpl.createEvent(cache, CACHE_ENTRY_INVALIDATED);
     configureEvent(e, key, value, pre, ctx, command, value, null);
     setTx(ctx, e);
     boolean isLocalNodePrimaryOwner = clusteringDependentLogic.localNodeIsPrimaryOwner(key);
     for (CacheEntryListenerInvocation<K, V> listener : cacheEntryInvalidatedListeners)
       listener.invoke(e, isLocalNodePrimaryOwner);
   }
 }
Exemplo n.º 2
0
 @Override
 public void notifyCacheEntryCreated(
     K key, V value, boolean pre, InvocationContext ctx, FlagAffectedCommand command) {
   if (!cacheEntryCreatedListeners.isEmpty()) {
     EventImpl<K, V> e = EventImpl.createEvent(cache, CACHE_ENTRY_CREATED);
     configureEvent(e, key, value, pre, ctx, command, null, null);
     boolean isLocalNodePrimaryOwner = clusteringDependentLogic.localNodeIsPrimaryOwner(key);
     for (CacheEntryListenerInvocation<K, V> listener : cacheEntryCreatedListeners)
       listener.invoke(e, isLocalNodePrimaryOwner);
     if (!ctx.isInTxScope()) {
       eventManager.sendEvents();
     }
   }
 }
Exemplo n.º 3
0
 @Override
 public void notifyCacheEntryRemoved(
     K key,
     V previousValue,
     Metadata previousMetadata,
     boolean pre,
     InvocationContext ctx,
     FlagAffectedCommand command) {
   if (isNotificationAllowed(command, cacheEntryRemovedListeners)) {
     EventImpl<K, V> e = EventImpl.createEvent(cache, CACHE_ENTRY_REMOVED);
     configureEvent(e, key, null, pre, ctx, command, previousValue, previousMetadata);
     setTx(ctx, e);
     boolean isLocalNodePrimaryOwner = clusteringDependentLogic.localNodeIsPrimaryOwner(key);
     for (CacheEntryListenerInvocation<K, V> listener : cacheEntryRemovedListeners)
       listener.invoke(e, isLocalNodePrimaryOwner);
     if (!ctx.isInTxScope()) {
       eventManager.sendEvents();
     }
   }
 }