DATAREDIS-275 - Rename RedisServerCommands.bgWriteAof to bgReWriteAof.

Renamed method and placed @Deprecated delegate-Methods in order to avoid breaking clients.

Original pull request: #44.
This commit is contained in:
Thomas Darimont
2014-03-06 17:36:41 +01:00
committed by Christoph Strobl
parent 86205e3b67
commit ec2a760dd6
6 changed files with 63 additions and 10 deletions

View File

@@ -42,6 +42,7 @@ import org.springframework.util.Assert;
* @author Costin Leau
* @author Jennifer Hickey
* @author Christoph Strobl
* @author Thomas Darimont
*/
public class DefaultStringRedisConnection implements StringRedisConnection {
@@ -135,8 +136,17 @@ public class DefaultStringRedisConnection implements StringRedisConnection {
delegate.bgSave();
}
@Override
public void bgReWriteAof() {
delegate.bgReWriteAof();
}
/**
* @deprecated As of 1.3, use {@link #bgReWriteAof}.
*/
@Deprecated
public void bgWriteAof() {
delegate.bgWriteAof();
bgReWriteAof();
}
public List<byte[]> bLPop(int timeout, byte[]... keys) {

View File

@@ -23,6 +23,7 @@ import java.util.Properties;
*
* @author Costin Leau
* @author Christoph Strobl
* @author Thomas Darimont
*/
public interface RedisServerCommands {
@@ -30,9 +31,19 @@ public interface RedisServerCommands {
* Start an {@literal Append Only File} rewrite process on server.
*
* @see http://redis.io/commands/bgrewriteaof
* @deprecated As of 1.3, use {@link #bgReWriteAof}.
*/
@Deprecated
void bgWriteAof();
/**
* Start an {@literal Append Only File} rewrite process on server.
*
* @see http://redis.io/commands/bgrewriteaof
* @since 1.3
*/
void bgReWriteAof();
/**
* Start background saving of db on server.
*

View File

@@ -42,7 +42,6 @@ import org.springframework.data.redis.connection.Subscription;
import org.springframework.data.redis.connection.convert.Converters;
import org.springframework.data.redis.connection.convert.TransactionResultConverter;
import org.springframework.util.Assert;
import org.springframework.util.NumberUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.ReflectionUtils;
@@ -466,7 +465,8 @@ public class JedisConnection implements RedisConnection {
}
}
public void bgWriteAof() {
@Override
public void bgReWriteAof() {
try {
if (isPipelined()) {
pipeline(new JedisStatusResult(pipeline.bgrewriteaof()));
@@ -482,6 +482,14 @@ public class JedisConnection implements RedisConnection {
}
}
/**
* @deprecated As of 1.3, use {@link #bgReWriteAof}.
*/
@Deprecated
public void bgWriteAof() {
bgReWriteAof();
}
public void save() {
try {
if (isPipelined()) {
@@ -2722,8 +2730,8 @@ public class JedisConnection implements RedisConnection {
List<String> serverTimeInformation = this.jedis.time();
Assert.notEmpty(serverTimeInformation, "Received invalid result from server. Expected 2 items in collection.");
Assert.isTrue(serverTimeInformation.size() == 2, "Received invalid nr of arguments from redis server. Expected 2 received "
+ serverTimeInformation.size());
Assert.isTrue(serverTimeInformation.size() == 2,
"Received invalid nr of arguments from redis server. Expected 2 received " + serverTimeInformation.size());
return Converters.toTimeMillis(serverTimeInformation.get(0), serverTimeInformation.get(1));
}

View File

@@ -231,7 +231,7 @@ public class JredisConnection implements RedisConnection {
}
}
public void bgWriteAof() {
public void bgReWriteAof() {
try {
jredis.bgrewriteaof();
} catch (Exception ex) {
@@ -239,6 +239,14 @@ public class JredisConnection implements RedisConnection {
}
}
/**
* @deprecated As of 1.3, use {@link #bgReWriteAof}.
*/
@Deprecated
public void bgWriteAof() {
bgReWriteAof();
}
public void save() {
try {
jredis.save();

View File

@@ -46,7 +46,6 @@ import org.springframework.data.redis.connection.Subscription;
import org.springframework.data.redis.connection.convert.Converters;
import org.springframework.data.redis.connection.convert.TransactionResultConverter;
import org.springframework.util.Assert;
import org.springframework.util.NumberUtils;
import org.springframework.util.ObjectUtils;
import com.lambdaworks.redis.RedisAsyncConnection;
@@ -480,7 +479,7 @@ public class LettuceConnection implements RedisConnection {
}
}
public void bgWriteAof() {
public void bgReWriteAof() {
try {
if (isPipelined()) {
pipeline(new LettuceStatusResult(getAsyncConnection().bgrewriteaof()));
@@ -496,6 +495,14 @@ public class LettuceConnection implements RedisConnection {
}
}
/**
* @deprecated As of 1.3, use {@link #bgReWriteAof}.
*/
@Deprecated
public void bgWriteAof() {
bgReWriteAof();
}
public void save() {
try {
if (isPipelined()) {
@@ -2776,7 +2783,7 @@ public class LettuceConnection implements RedisConnection {
* support the time command natively.
* see https://github.com/wg/lettuce/issues/19
*/
List<byte[]> result = (List<byte[]>)eval("return redis.call('TIME')".getBytes(),ReturnType.MULTI,0);
List<byte[]> result = (List<byte[]>) eval("return redis.call('TIME')".getBytes(), ReturnType.MULTI, 0);
Assert.notEmpty(result, "Received invalid result from server. Expected 2 items in collection.");
Assert.isTrue(result.size() == 2, "Received invalid nr of arguments from redis server. Expected 2 received "

View File

@@ -60,6 +60,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* @author Costin Leau
* @author Jennifer Hickey
* @author Christoph Strobl
* @author Thomas Darimont
*/
public class SrpConnection implements RedisConnection {
@@ -363,7 +364,7 @@ public class SrpConnection implements RedisConnection {
}
}
public void bgWriteAof() {
public void bgReWriteAof() {
try {
if (isPipelined()) {
pipeline(new SrpStatusResult(pipeline.bgrewriteaof()));
@@ -375,6 +376,14 @@ public class SrpConnection implements RedisConnection {
}
}
/**
* @deprecated As of 1.3, use {@link #bgReWriteAof}.
*/
@Deprecated
public void bgWriteAof() {
bgReWriteAof();
}
public void save() {
try {
if (isPipelined()) {