Skip to content

Commit ec2a760

Browse files
Thomas Darimontchristophstrobl
Thomas Darimont
authored andcommitted
DATAREDIS-275 - Rename RedisServerCommands.bgWriteAof to bgReWriteAof.
Renamed method and placed @deprecated delegate-Methods in order to avoid breaking clients. Original pull request: #44.
1 parent 86205e3 commit ec2a760

File tree

6 files changed

+63
-10
lines changed

6 files changed

+63
-10
lines changed

src/main/java/org/springframework/data/redis/connection/DefaultStringRedisConnection.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
* @author Costin Leau
4343
* @author Jennifer Hickey
4444
* @author Christoph Strobl
45+
* @author Thomas Darimont
4546
*/
4647
public class DefaultStringRedisConnection implements StringRedisConnection {
4748

@@ -135,8 +136,17 @@ public void bgSave() {
135136
delegate.bgSave();
136137
}
137138

139+
@Override
140+
public void bgReWriteAof() {
141+
delegate.bgReWriteAof();
142+
}
143+
144+
/**
145+
* @deprecated As of 1.3, use {@link #bgReWriteAof}.
146+
*/
147+
@Deprecated
138148
public void bgWriteAof() {
139-
delegate.bgWriteAof();
149+
bgReWriteAof();
140150
}
141151

142152
public List<byte[]> bLPop(int timeout, byte[]... keys) {

src/main/java/org/springframework/data/redis/connection/RedisServerCommands.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,27 @@
2323
*
2424
* @author Costin Leau
2525
* @author Christoph Strobl
26+
* @author Thomas Darimont
2627
*/
2728
public interface RedisServerCommands {
2829

2930
/**
3031
* Start an {@literal Append Only File} rewrite process on server.
3132
*
3233
* @see http://redis.io/commands/bgrewriteaof
34+
* @deprecated As of 1.3, use {@link #bgReWriteAof}.
3335
*/
36+
@Deprecated
3437
void bgWriteAof();
3538

39+
/**
40+
* Start an {@literal Append Only File} rewrite process on server.
41+
*
42+
* @see http://redis.io/commands/bgrewriteaof
43+
* @since 1.3
44+
*/
45+
void bgReWriteAof();
46+
3647
/**
3748
* Start background saving of db on server.
3849
*

src/main/java/org/springframework/data/redis/connection/jedis/JedisConnection.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import org.springframework.data.redis.connection.convert.Converters;
4343
import org.springframework.data.redis.connection.convert.TransactionResultConverter;
4444
import org.springframework.util.Assert;
45-
import org.springframework.util.NumberUtils;
4645
import org.springframework.util.ObjectUtils;
4746
import org.springframework.util.ReflectionUtils;
4847

@@ -466,7 +465,8 @@ public void bgSave() {
466465
}
467466
}
468467

469-
public void bgWriteAof() {
468+
@Override
469+
public void bgReWriteAof() {
470470
try {
471471
if (isPipelined()) {
472472
pipeline(new JedisStatusResult(pipeline.bgrewriteaof()));
@@ -482,6 +482,14 @@ public void bgWriteAof() {
482482
}
483483
}
484484

485+
/**
486+
* @deprecated As of 1.3, use {@link #bgReWriteAof}.
487+
*/
488+
@Deprecated
489+
public void bgWriteAof() {
490+
bgReWriteAof();
491+
}
492+
485493
public void save() {
486494
try {
487495
if (isPipelined()) {
@@ -2722,8 +2730,8 @@ public Long time() {
27222730
List<String> serverTimeInformation = this.jedis.time();
27232731

27242732
Assert.notEmpty(serverTimeInformation, "Received invalid result from server. Expected 2 items in collection.");
2725-
Assert.isTrue(serverTimeInformation.size() == 2, "Received invalid nr of arguments from redis server. Expected 2 received "
2726-
+ serverTimeInformation.size());
2733+
Assert.isTrue(serverTimeInformation.size() == 2,
2734+
"Received invalid nr of arguments from redis server. Expected 2 received " + serverTimeInformation.size());
27272735

27282736
return Converters.toTimeMillis(serverTimeInformation.get(0), serverTimeInformation.get(1));
27292737
}

src/main/java/org/springframework/data/redis/connection/jredis/JredisConnection.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,14 +231,22 @@ public void bgSave() {
231231
}
232232
}
233233

234-
public void bgWriteAof() {
234+
public void bgReWriteAof() {
235235
try {
236236
jredis.bgrewriteaof();
237237
} catch (Exception ex) {
238238
throw convertJredisAccessException(ex);
239239
}
240240
}
241241

242+
/**
243+
* @deprecated As of 1.3, use {@link #bgReWriteAof}.
244+
*/
245+
@Deprecated
246+
public void bgWriteAof() {
247+
bgReWriteAof();
248+
}
249+
242250
public void save() {
243251
try {
244252
jredis.save();

src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnection.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
import org.springframework.data.redis.connection.convert.Converters;
4747
import org.springframework.data.redis.connection.convert.TransactionResultConverter;
4848
import org.springframework.util.Assert;
49-
import org.springframework.util.NumberUtils;
5049
import org.springframework.util.ObjectUtils;
5150

5251
import com.lambdaworks.redis.RedisAsyncConnection;
@@ -480,7 +479,7 @@ public void bgSave() {
480479
}
481480
}
482481

483-
public void bgWriteAof() {
482+
public void bgReWriteAof() {
484483
try {
485484
if (isPipelined()) {
486485
pipeline(new LettuceStatusResult(getAsyncConnection().bgrewriteaof()));
@@ -496,6 +495,14 @@ public void bgWriteAof() {
496495
}
497496
}
498497

498+
/**
499+
* @deprecated As of 1.3, use {@link #bgReWriteAof}.
500+
*/
501+
@Deprecated
502+
public void bgWriteAof() {
503+
bgReWriteAof();
504+
}
505+
499506
public void save() {
500507
try {
501508
if (isPipelined()) {
@@ -2776,7 +2783,7 @@ public Long time() {
27762783
* support the time command natively.
27772784
* see https://github.com/wg/lettuce/issues/19
27782785
*/
2779-
List<byte[]> result = (List<byte[]>)eval("return redis.call('TIME')".getBytes(),ReturnType.MULTI,0);
2786+
List<byte[]> result = (List<byte[]>) eval("return redis.call('TIME')".getBytes(), ReturnType.MULTI, 0);
27802787

27812788
Assert.notEmpty(result, "Received invalid result from server. Expected 2 items in collection.");
27822789
Assert.isTrue(result.size() == 2, "Received invalid nr of arguments from redis server. Expected 2 received "

src/main/java/org/springframework/data/redis/connection/srp/SrpConnection.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
* @author Costin Leau
6161
* @author Jennifer Hickey
6262
* @author Christoph Strobl
63+
* @author Thomas Darimont
6364
*/
6465
public class SrpConnection implements RedisConnection {
6566

@@ -363,7 +364,7 @@ public void bgSave() {
363364
}
364365
}
365366

366-
public void bgWriteAof() {
367+
public void bgReWriteAof() {
367368
try {
368369
if (isPipelined()) {
369370
pipeline(new SrpStatusResult(pipeline.bgrewriteaof()));
@@ -375,6 +376,14 @@ public void bgWriteAof() {
375376
}
376377
}
377378

379+
/**
380+
* @deprecated As of 1.3, use {@link #bgReWriteAof}.
381+
*/
382+
@Deprecated
383+
public void bgWriteAof() {
384+
bgReWriteAof();
385+
}
386+
378387
public void save() {
379388
try {
380389
if (isPipelined()) {

0 commit comments

Comments
 (0)