All Downloads are FREE. Search and download functionalities are using the official Maven repository.

redis.clients.jedis.Queable Maven / Gradle / Ivy

The newest version!
package redis.clients.jedis;

import java.util.LinkedList;
import java.util.Queue;

public class Queable {
  private Queue> pipelinedResponses = new LinkedList>();

  protected void clean() {
    pipelinedResponses.clear();
  }

  protected Response generateResponse(Object data) {
    Response response = pipelinedResponses.poll();
    if (response != null) {
      response.set(data);
    }
    return response;
  }

  protected  Response getResponse(Builder builder) {
    Response lr = new Response(builder);
    pipelinedResponses.add(lr);
    return lr;
  }

  protected boolean hasPipelinedResponse() {
    return !pipelinedResponses.isEmpty();
  }

  protected int getPipelinedResponseLength() {
    return pipelinedResponses.size();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy