コード例 #1
0
 @Override
 public Object visitPutMapCommand(InvocationContext ctx, PutMapCommand command)
     throws Throwable {
   Metadata metadata = command.getMetadata();
   backupCache.putAll(
       command.getMap(),
       metadata.lifespan(),
       TimeUnit.MILLISECONDS,
       metadata.maxIdle(),
       TimeUnit.MILLISECONDS);
   return null;
 }
コード例 #2
0
 @Override
 public Object visitPutMapCommand(InvocationContext ctx, PutMapCommand command)
     throws Throwable {
   Map<Object, Object> newMap = new HashMap<>(4);
   for (Map.Entry<Object, Object> e : command.getMap().entrySet()) {
     Object key = e.getKey();
     if (cdl.localNodeIsOwner(key)) {
       entryFactory.wrapEntryForWriting(ctx, key, EntryFactory.Wrap.WRAP_ALL, true, false);
       newMap.put(key, e.getValue());
     }
   }
   if (newMap.size() > 0) {
     PutMapCommand clonedCommand =
         commandFactory.buildPutMapCommand(
             newMap, command.getMetadata(), command.getFlagsBitSet());
     ctx.forkInvocationSync(clonedCommand);
   }
   return null;
 }