@Override
 public void notifyCacheEntryModified(
     Object key,
     Object value,
     boolean created,
     boolean pre,
     InvocationContext ctx,
     FlagAffectedCommand command) {
   if (!cacheEntryModifiedListeners.isEmpty()) {
     boolean originLocal = ctx.isOriginLocal();
     EventImpl<Object, Object> e = EventImpl.createEvent(cache, CACHE_ENTRY_MODIFIED);
     e.setOriginLocal(originLocal);
     e.setValue(value);
     e.setPre(pre);
     e.setKey(key);
     // Even if CacheEntryCreatedEvent.getValue() has been added, to
     // avoid breaking old behaviour and make it easy to comply with
     // JSR-107 specification TCK, it's necessary to find out whether a
     // modification is the result of a cache entry being created or not.
     // This is needed because on JSR-107, a modification is only fired
     // when the entry is updated, and only one event is fired, so you
     // want to fire it when isPre=false.
     e.setCreated(created);
     setTx(ctx, e);
     for (ListenerInvocation listener : cacheEntryModifiedListeners) listener.invoke(e);
   }
 }
 @Override
 public void notifyTransactionRegistered(
     GlobalTransaction globalTransaction, InvocationContext ctx) {
   if (!transactionRegisteredListeners.isEmpty()) {
     boolean isOriginLocal = ctx.isOriginLocal();
     EventImpl<Object, Object> e = EventImpl.createEvent(cache, TRANSACTION_REGISTERED);
     e.setOriginLocal(isOriginLocal);
     e.setTransactionId(globalTransaction);
     for (ListenerInvocation listener : transactionRegisteredListeners) listener.invoke(e);
   }
 }
 @Override
 public void notifyTransactionCompleted(
     GlobalTransaction transaction, boolean successful, InvocationContext ctx) {
   if (!transactionCompletedListeners.isEmpty()) {
     boolean isOriginLocal = ctx.isOriginLocal();
     EventImpl<Object, Object> e = EventImpl.createEvent(cache, TRANSACTION_COMPLETED);
     e.setOriginLocal(isOriginLocal);
     e.setTransactionId(transaction);
     e.setTransactionSuccessful(successful);
     for (ListenerInvocation listener : transactionCompletedListeners) listener.invoke(e);
   }
 }
 @Override
 public void notifyCacheEntryActivated(
     Object key, Object value, boolean pre, InvocationContext ctx, FlagAffectedCommand command) {
   if (isNotificationAllowed(command, cacheEntryActivatedListeners)) {
     boolean originLocal = ctx.isOriginLocal();
     EventImpl<Object, Object> e = EventImpl.createEvent(cache, CACHE_ENTRY_ACTIVATED);
     e.setOriginLocal(originLocal);
     e.setPre(pre);
     e.setKey(key);
     e.setValue(value);
     setTx(ctx, e);
     for (ListenerInvocation listener : cacheEntryActivatedListeners) listener.invoke(e);
   }
 }
 @Override
 public void notifyCacheEntryCreated(
     Object key, Object value, boolean pre, InvocationContext ctx, FlagAffectedCommand command) {
   if (!cacheEntryCreatedListeners.isEmpty()) {
     boolean originLocal = ctx.isOriginLocal();
     EventImpl<Object, Object> e = EventImpl.createEvent(cache, CACHE_ENTRY_CREATED);
     e.setOriginLocal(originLocal);
     // Added capability to set cache entry created value in order
     // to avoid breaking behaviour of CacheEntryModifiedEvent.getValue()
     // when isPre=false.
     e.setValue(value);
     e.setPre(pre);
     e.setKey(key);
     setTx(ctx, e);
     for (ListenerInvocation listener : cacheEntryCreatedListeners) listener.invoke(e);
   }
 }