예제 #1
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();
     }
   }
 }
예제 #2
0
 @Override
 public void notifyTransactionCompleted(
     GlobalTransaction transaction, boolean successful, InvocationContext ctx) {
   if (!transactionCompletedListeners.isEmpty()) {
     boolean isOriginLocal = ctx.isOriginLocal();
     EventImpl<K, V> e = EventImpl.createEvent(cache, TRANSACTION_COMPLETED);
     e.setOriginLocal(isOriginLocal);
     e.setTransactionId(transaction);
     e.setTransactionSuccessful(successful);
     for (CacheEntryListenerInvocation<K, V> listener : transactionCompletedListeners)
       listener.invoke(e);
     if (ctx.isInTxScope()) {
       if (successful) {
         eventManager.sendEvents();
       } else {
         eventManager.dropEvents();
       }
     }
   }
 }
예제 #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();
     }
   }
 }