
org.infinispan.stream.impl.StreamRequestCommand Maven / Gradle / Ivy
package org.infinispan.stream.impl;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import org.infinispan.commands.TopologyAffectedCommand;
import org.infinispan.commands.remote.BaseRpcCommand;
import org.infinispan.commons.marshall.MarshallUtil;
import org.infinispan.factories.annotations.Inject;
import org.infinispan.remoting.transport.Address;
import org.infinispan.util.ByteString;
import org.infinispan.util.concurrent.CompletableFutures;
/**
* Stream request command that is sent to remote nodes handle execution of remote intermediate and terminal operations.
* @param the key type
*/
public class StreamRequestCommand extends BaseRpcCommand implements TopologyAffectedCommand {
public static final byte COMMAND_ID = 47;
private LocalStreamManager lsm;
private Object id;
private Type type;
private boolean parallelStream;
private Set segments;
private Set keys;
private Set excludedKeys;
private boolean includeLoader;
private Object terminalOperation;
private int topologyId = -1;
@Override
public int getTopologyId() {
return topologyId;
}
@Override
public void setTopologyId(int topologyId) {
this.topologyId = topologyId;
}
public Object getId() {
return id;
}
public enum Type {
TERMINAL,
TERMINAL_REHASH,
TERMINAL_KEY,
TERMINAL_KEY_REHASH;
private static final Type[] CACHED_VALUES = values();
}
// Only here for CommandIdUniquenessTest
private StreamRequestCommand() { super(null); }
public StreamRequestCommand(ByteString cacheName) {
super(cacheName);
}
public StreamRequestCommand(ByteString cacheName, Address origin, Object id, boolean parallelStream, Type type,
Set segments, Set keys, Set excludedKeys, boolean includeLoader,
Object terminalOperation) {
super(cacheName);
setOrigin(origin);
this.id = id;
this.parallelStream = parallelStream;
this.type = type;
this.segments = segments;
this.keys = keys;
this.excludedKeys = excludedKeys;
this.includeLoader = includeLoader;
this.terminalOperation = terminalOperation;
}
@Inject
public void inject(LocalStreamManager lsm) {
this.lsm = lsm;
}
@Override
public CompletableFuture
© 2015 - 2025 Weber Informatics LLC | Privacy Policy