/** * @throws org.apache.geode.SerializationException if serialization fails */ public RemoveAllOpImpl(Region region, Collection<Object> keys, EventID eventId, boolean prSingleHopEnabled, Object callbackArg) { super(MessageType.REMOVE_ALL, 5 + keys.size()); this.prSingleHopEnabled = prSingleHopEnabled; this.region = (LocalRegion) region; getMessage().addStringPart(region.getFullPath()); getMessage().addBytesPart(eventId.calcBytes()); this.keys = keys; this.callbackArg = callbackArg; }
@Override protected void initMessagePart() { int size = keys.size(); int flags = 0; if (region.getDataPolicy() == DataPolicy.EMPTY) { flags |= FLAG_EMPTY; } if (region.getConcurrencyChecksEnabled()) { flags |= FLAG_CONCURRENCY_CHECKS; } getMessage().addIntPart(flags); getMessage().addObjPart(this.callbackArg); getMessage().addIntPart(size); for (Object key : this.keys) { getMessage().addStringOrObjPart(key); } }
/** * Does a region removeAll on a server using connections from the given pool to communicate with * the server. * * @param pool the pool to use to communicate with the server. * @param region the name of the region to do the removeAll on * @param keys Collection of keys to remove * @param eventId the event id for this op */ public static VersionedObjectList execute(ExecutablePool pool, Region region, Collection<Object> keys, EventID eventId, boolean isRetry, Object callbackArg) { RemoveAllOpImpl op = new RemoveAllOpImpl(region, keys, eventId, ((PoolImpl) pool).getPRSingleHopEnabled(), callbackArg); op.initMessagePart(); if (isRetry) { op.getMessage().setIsRetry(); } return (VersionedObjectList) pool.execute(op); }