
org.infinispan.commands.write.PrimaryAckCommand Maven / Gradle / Ivy
package org.infinispan.commands.write;
import org.infinispan.commands.CommandInvocationId;
import org.infinispan.commands.remote.BaseRpcCommand;
import org.infinispan.commons.marshall.MarshallUtil;
import org.infinispan.util.ByteString;
import org.infinispan.util.concurrent.CommandAckCollector;
import org.infinispan.util.concurrent.CompletableFutures;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.concurrent.CompletableFuture;
/**
* A command that represents an acknowledge sent by the primary owner to the originator.
*
* The acknowledge signals a successful or unsuccessful execution of the operation and it contains the return value of
* the operation.
*
* @author Pedro Ruivo
* @since 9.0
*/
public class PrimaryAckCommand extends BaseRpcCommand {
public static final byte COMMAND_ID = 30;
private static final Type[] CACHED_TYPE = Type.values();
private CommandInvocationId commandInvocationId;
private Object returnValue;
private Type type;
private CommandAckCollector commandAckCollector;
private int topologyId;
public PrimaryAckCommand() {
super(null);
}
public PrimaryAckCommand(ByteString cacheName) {
super(cacheName);
}
private static Type valueOf(int index) {
return CACHED_TYPE[index];
}
public void initCommandInvocationIdAndTopologyId(CommandInvocationId id, int topologyId) {
this.commandInvocationId = id;
this.topologyId = topologyId;
}
@Override
public CompletableFuture