Make SRP return converted tx results

DATAREDIS-208
This commit is contained in:
Jennifer Hickey
2013-07-23 14:37:03 -07:00
parent 08d502083c
commit aa8d10b150
6 changed files with 44 additions and 416 deletions

View File

@@ -78,7 +78,7 @@ public class SrpConnection implements RedisConnection {
private PipelineTracker callback;
private PipelineTracker txTracker;
private volatile SrpSubscription subscription;
private boolean convertPipelineResults=true;
private boolean convertPipelineAndTxResults=true;
@SuppressWarnings("rawtypes")
@@ -2180,13 +2180,13 @@ public class SrpConnection implements RedisConnection {
/**
* Specifies if pipelined results should be converted to the expected data
* type. If false, results of {@link #closePipeline()} will be of the
* type. If false, results of {@link #closePipeline()} and {@link #exec()} will be of the
* type returned by the Lettuce driver
*
* @param convertPipelineResults Whether or not to convert pipeline results
*/
public void setConvertPipelineResults(boolean convertPipelineResults) {
this.convertPipelineResults = convertPipelineResults;
public void setConvertPipelineAndTxResults(boolean convertPipelineAndTxResults) {
this.convertPipelineAndTxResults = convertPipelineAndTxResults;
}
private void checkSubscription() {
@@ -2207,14 +2207,14 @@ public class SrpConnection implements RedisConnection {
private void initPipeline() {
if (pipeline == null) {
callback = new PipelineTracker(convertPipelineResults);
callback = new PipelineTracker(convertPipelineAndTxResults);
pipeline = client.pipeline();
}
}
private void initTxTracker() {
if(txTracker == null) {
txTracker = new PipelineTracker(false);
txTracker = new PipelineTracker(convertPipelineAndTxResults);
}
initPipeline();
}

View File

@@ -35,7 +35,7 @@ public class SrpConnectionFactory implements InitializingBean, DisposableBean, R
private String hostName = "localhost";
private int port = 6379;
private BlockingQueue<SrpConnection> trackedConnections = new ArrayBlockingQueue<SrpConnection>(50);
private boolean convertPipelineResults = true;
private boolean convertPipelineAndTxResults = true;
/**
@@ -73,7 +73,7 @@ public class SrpConnectionFactory implements InitializingBean, DisposableBean, R
public RedisConnection getConnection() {
SrpConnection connection = new SrpConnection(hostName, port, trackedConnections);
connection.setConvertPipelineResults(convertPipelineResults);
connection.setConvertPipelineAndTxResults(convertPipelineAndTxResults);
return connection;
}
@@ -119,23 +119,23 @@ public class SrpConnectionFactory implements InitializingBean, DisposableBean, R
/**
* Specifies if pipelined results should be converted to the expected data
* type. If false, results of {@link #closePipeline()} will be of the
* type returned by the Jedis driver
* type. If false, results of {@link SrpConnection#closePipeline()} and {@link SrpConnection#exec()}
* will be of the type returned by the SRP driver
*
* @return Whether or not to convert pipeline results
* @return Whether or not to convert pipeline and tx results
*/
public boolean getConvertPipelineResults() {
return convertPipelineResults;
public boolean getConvertPipelineAndTxResults() {
return convertPipelineAndTxResults;
}
/**
* Specifies if pipelined results should be converted to the expected data
* type. If false, results of {@link #closePipeline()} will be of the
* type returned by the Jedis driver
* type. If false, results of {@link SrpConnection#closePipeline()} and {@link SrpConnection#exec()}
* will be of the type returned by the SRP driver
*
* @param convertPipelineResults Whether or not to convert pipeline results
* @param convertPipelineResults Whether or not to convert pipeline and tx results
*/
public void setConvertPipelineResults(boolean convertPipelineResults) {
this.convertPipelineResults = convertPipelineResults;
public void setConvertPipelineAndTxResults(boolean convertPipelineAndTxResults) {
this.convertPipelineAndTxResults = convertPipelineAndTxResults;
}
}