Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package redis.clients.jedis;
import java.io.Closeable;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import redis.clients.jedis.commands.DatabasePipelineCommands;
import redis.clients.jedis.exceptions.JedisDataException;
import redis.clients.jedis.graph.GraphCommandObjects;
import redis.clients.jedis.params.*;
import redis.clients.jedis.util.KeyValue;
public class Pipeline extends PipelineBase implements DatabasePipelineCommands, Closeable {
private final Queue> pipelinedResponses = new LinkedList<>();
protected final Connection connection;
private final boolean closeConnection;
//private final CommandObjects commandObjects;
public Pipeline(Jedis jedis) {
this(jedis.getConnection(), false);
}
public Pipeline(Connection connection) {
this(connection, false);
}
public Pipeline(Connection connection, boolean closeConnection) {
super(new CommandObjects());
this.connection = connection;
this.closeConnection = closeConnection;
RedisProtocol proto = this.connection.getRedisProtocol();
if (proto != null) this.commandObjects.setProtocol(proto);
setGraphCommands(new GraphCommandObjects(this.connection));
}
@Override
public final Response appendCommand(CommandObject commandObject) {
connection.sendCommand(commandObject.getArguments());
Response response = new Response<>(commandObject.getBuilder());
pipelinedResponses.add(response);
return response;
}
@Override
public void close() {
sync();
if (closeConnection) {
connection.close();
}
}
/**
* Synchronize pipeline by reading all responses. This operation close the pipeline. In order to
* get return values from pipelined commands, capture the different Response<?> of the
* commands you execute.
*/
@Override
public void sync() {
if (!hasPipelinedResponse()) return;
List