org.infinispan.statetransfer.StateRequestCommand Maven / Gradle / Ivy
package org.infinispan.statetransfer;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import org.infinispan.commands.TopologyAffectedCommand;
import org.infinispan.commands.remote.BaseRpcCommand;
import org.infinispan.commons.CacheException;
import org.infinispan.commons.marshall.MarshallUtil;
import org.infinispan.commons.util.IntSet;
import org.infinispan.distexec.DistributedCallable;
import org.infinispan.remoting.transport.Address;
import org.infinispan.scattered.BiasManager;
import org.infinispan.scattered.ScatteredStateProvider;
import org.infinispan.util.ByteString;
import org.infinispan.util.concurrent.CompletableFutures;
import org.infinispan.util.logging.Log;
import org.infinispan.util.logging.LogFactory;
/**
* This command is used by a StateConsumer to request transactions and cache entries from a StateProvider.
*
* @author [email protected]
* @since 5.2
*/
public class StateRequestCommand extends BaseRpcCommand implements TopologyAffectedCommand {
private static final Log log = LogFactory.getLog(StateRequestCommand.class);
public enum Type {
GET_TRANSACTIONS,
GET_CACHE_LISTENERS,
START_CONSISTENCY_CHECK,
CANCEL_CONSISTENCY_CHECK,
START_KEYS_TRANSFER,
START_STATE_TRANSFER,
CANCEL_STATE_TRANSFER,
CONFIRM_REVOKED_SEGMENTS,
;
private static final Type[] CACHED_VALUES = values();
}
public static final byte COMMAND_ID = 15;
private Type type = Type.CANCEL_STATE_TRANSFER; //default value for org.infinispan.remoting.AsynchronousInvocationTest
private int topologyId;
private IntSet segments;
private StateProvider stateProvider;
private BiasManager biasManager;
private StateRequestCommand() {
super(null); // for command id uniqueness test
}
public StateRequestCommand(ByteString cacheName) {
super(cacheName);
}
public StateRequestCommand(ByteString cacheName, Type type, Address origin, int topologyId, IntSet segments) {
super(cacheName);
this.type = type;
setOrigin(origin);
this.topologyId = topologyId;
this.segments = segments;
}
public void init(StateProvider stateProvider, BiasManager biasManager) {
this.stateProvider = stateProvider;
this.biasManager = biasManager;
}
@Override
public CompletableFuture
© 2015 - 2025 Weber Informatics LLC | Privacy Policy