@Override
 public Object visitRemoveCommand(InvocationContext ctx, RemoveCommand command)
     throws Throwable {
   if (command.isConditional()) {
     return backupCache.remove(command.getKey(), command.getValue());
   }
   return backupCache.remove(command.getKey());
 }
 private void wrapEntryForRemoveIfNeeded(InvocationContext ctx, RemoveCommand command)
     throws InterruptedException {
   if (shouldWrap(command.getKey(), ctx, command)) {
     boolean forceWrap = command.getValueMatcher().nonExistentEntryCanMatch();
     EntryFactory.Wrap wrap =
         forceWrap ? EntryFactory.Wrap.WRAP_ALL : EntryFactory.Wrap.WRAP_NON_NULL;
     boolean skipRead = command.hasFlag(Flag.IGNORE_RETURN_VALUES) && !command.isConditional();
     entryFactory.wrapEntryForWriting(ctx, command.getKey(), wrap, skipRead, false);
   }
 }
 @Override
 public Object visitRemoveCommand(InvocationContext ctx, RemoveCommand command)
     throws Throwable {
   if (cdl.localNodeIsOwner(command.getKey())) {
     boolean forceWrap = command.getValueMatcher().nonExistentEntryCanMatch();
     EntryFactory.Wrap wrap =
         forceWrap ? EntryFactory.Wrap.WRAP_ALL : EntryFactory.Wrap.WRAP_NON_NULL;
     entryFactory.wrapEntryForWriting(ctx, command.getKey(), wrap, false, false);
     ctx.forkInvocationSync(command);
   }
   return null;
 }
 @Override
 public Object visitRemoveCommand(InvocationContext ctx, RemoveCommand command)
     throws Throwable {
   processCommand(command);
   result.add(command.getKey());
   return null;
 }
 @Override
 public Object visitRemoveCommand(InvocationContext ctx, RemoveCommand command) throws Throwable {
   Object retval = invokeNextInterceptor(ctx, command);
   Object key = command.getKey();
   if (!skip(ctx, key, command) && !ctx.isInTxScope() && command.isSuccessful()) {
     boolean resp = store.remove(key);
     log.tracef("Removed entry under key %s and got response %s from CacheStore", key, resp);
   }
   return retval;
 }
Exemplo n.º 6
0
  @Override
  public Object visitRemoveCommand(InvocationContext ctx, RemoveCommand command) throws Throwable {
    // remove the object out of the cache first.
    Object valueRemoved = invokeNextInterceptor(ctx, command);

    if (command.isSuccessful() && !command.isNonExistent() && shouldModifyIndexes(ctx)) {
      Object value = extractValue(valueRemoved);
      if (updateKnownTypesIfNeeded(value)) {
        removeFromIndexes(value, extractValue(command.getKey()));
      }
    }
    return valueRemoved;
  }
Exemplo n.º 7
0
 /**
  * Indexing management of a RemoveCommand
  *
  * @param command the visited RemoveCommand
  * @param ctx the InvocationContext of the RemoveCommand
  * @param valueRemoved the value before the removal
  * @param transactionContext Optional for lazy initialization, or reuse an existing context.
  */
 private void processRemoveCommand(
     final RemoveCommand command,
     final InvocationContext ctx,
     final Object valueRemoved,
     TransactionContext transactionContext) {
   if (command.isSuccessful() && !command.isNonExistent() && shouldModifyIndexes(command, ctx)) {
     final Object value = extractValue(valueRemoved);
     if (updateKnownTypesIfNeeded(value)) {
       transactionContext =
           transactionContext == null ? makeTransactionalEventContext() : transactionContext;
       removeFromIndexes(value, extractValue(command.getKey()), transactionContext);
     }
   }
 }
 @Override
 public CompletableFuture<Void> visitRemoveCommand(InvocationContext ctx, RemoveCommand command)
     throws Throwable {
   return visitWriteCommand(ctx, command, command.getKey());
 }
 @Override
 public Object visitRemoveCommand(InvocationContext ctx, RemoveCommand command) throws Throwable {
   return handleInvalidate(ctx, command, command.getKey());
 }
 @Override
 public Object visitRemoveCommand(InvocationContext ctx, RemoveCommand command) throws Throwable {
   if (isStoreAsBinary() || isClusterInvocation(ctx) || isStoreInvocation(ctx))
     checkMarshallable(command.getKey());
   return super.visitRemoveCommand(ctx, command);
 }
  @Override
  public Object visitRemoveCommand(InvocationContext ctx, RemoveCommand command) throws Throwable {

    return handleWriteCommand(
        ctx, command, new SingleKeyRecipientGenerator(command.getKey()), false, false);
  }