Merge branch 'remove_deprecated_transactionblock_and_pipelineblock' of https://github.com/HeartSaVioR/jedis into HeartSaVioR-remove_deprecated_transactionblock_and_pipelineblock
Conflicts: src/main/java/redis/clients/jedis/BinaryJedis.java src/main/java/redis/clients/jedis/PipelineBlock.java src/main/java/redis/clients/jedis/TransactionBlock.java
This commit is contained in:
@@ -1778,23 +1778,6 @@ public class BinaryJedis implements BasicCommands, BinaryJedisCommands,
|
||||
return transaction;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
/**
|
||||
* This method is deprecated due to its error prone
|
||||
* and will be removed on next major release
|
||||
* You can use multi() instead
|
||||
* @see https://github.com/xetorthio/jedis/pull/498
|
||||
*/
|
||||
public List<Object> multi(final TransactionBlock jedisTransaction) {
|
||||
List<Object> results = null;
|
||||
jedisTransaction.setClient(client);
|
||||
client.multi();
|
||||
client.getOne(); // expected OK
|
||||
jedisTransaction.execute();
|
||||
results = jedisTransaction.exec();
|
||||
return results;
|
||||
}
|
||||
|
||||
protected void checkIsInMulti() {
|
||||
if (client.isInMulti()) {
|
||||
throw new JedisDataException(
|
||||
@@ -2230,19 +2213,6 @@ public class BinaryJedis implements BasicCommands, BinaryJedisCommands,
|
||||
return client.getStatusCodeReply();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
/**
|
||||
* This method is deprecated due to its error prone with multi
|
||||
* and will be removed on next major release
|
||||
* You can use pipelined() instead
|
||||
* @see https://github.com/xetorthio/jedis/pull/498
|
||||
*/
|
||||
public List<Object> pipelined(final PipelineBlock jedisPipeline) {
|
||||
jedisPipeline.setClient(client);
|
||||
jedisPipeline.execute();
|
||||
return jedisPipeline.syncAndReturnAll();
|
||||
}
|
||||
|
||||
public Pipeline pipelined() {
|
||||
pipeline = new Pipeline();
|
||||
pipeline.setClient(client);
|
||||
|
||||
@@ -537,19 +537,6 @@ public class BinaryShardedJedis extends Sharded<Jedis, JedisShardInfo>
|
||||
return j.linsert(key, where, pivot, value);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
/**
|
||||
* This method is deprecated due to its error prone with multi
|
||||
* and will be removed on next major release
|
||||
* You can use pipelined() instead
|
||||
* @see https://github.com/xetorthio/jedis/pull/498
|
||||
*/
|
||||
public List<Object> pipelined(ShardedJedisPipeline shardedJedisPipeline) {
|
||||
shardedJedisPipeline.setShardedJedis(this);
|
||||
shardedJedisPipeline.execute();
|
||||
return shardedJedisPipeline.getResults();
|
||||
}
|
||||
|
||||
public ShardedJedisPipeline pipelined() {
|
||||
ShardedJedisPipeline pipeline = new ShardedJedisPipeline();
|
||||
pipeline.setShardedJedis(this);
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package redis.clients.jedis;
|
||||
|
||||
@Deprecated
|
||||
/**
|
||||
* This method is deprecated due to its error prone with multi
|
||||
* and will be removed on next major release
|
||||
* @see https://github.com/xetorthio/jedis/pull/498
|
||||
*/
|
||||
public abstract class PipelineBlock extends Pipeline {
|
||||
// For shadowing
|
||||
@SuppressWarnings("unused")
|
||||
private Client client;
|
||||
|
||||
public abstract void execute();
|
||||
}
|
||||
@@ -61,14 +61,6 @@ public class ShardedJedisPipeline extends PipelineBase {
|
||||
return formatted;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be removed in Jedis 3.0. Use the methods that return
|
||||
* Response's and call sync().
|
||||
*/
|
||||
@Deprecated
|
||||
public void execute() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Client getClient(String key) {
|
||||
Client client = jedis.getShard(key).getClient();
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
package redis.clients.jedis;
|
||||
|
||||
import redis.clients.jedis.exceptions.JedisException;
|
||||
|
||||
@Deprecated
|
||||
/**
|
||||
* This class is deprecated due to its error prone
|
||||
* and will be removed on next major release
|
||||
* @see https://github.com/xetorthio/jedis/pull/498
|
||||
*/
|
||||
public abstract class TransactionBlock extends Transaction {
|
||||
// For shadowing
|
||||
@SuppressWarnings("unused")
|
||||
private Client client;
|
||||
|
||||
public TransactionBlock(Client client) {
|
||||
super(client);
|
||||
}
|
||||
|
||||
public TransactionBlock() {
|
||||
}
|
||||
|
||||
public abstract void execute() throws JedisException;
|
||||
|
||||
public void setClient(Client client) {
|
||||
super.setClient(client);
|
||||
}
|
||||
}
|
||||
@@ -142,37 +142,6 @@ public class ShardedJedisTest extends Assert {
|
||||
assertNotSame(s5, s6);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shardedPipeline() {
|
||||
List<JedisShardInfo> shards = new ArrayList<JedisShardInfo>();
|
||||
shards.add(new JedisShardInfo(redis1.getHost(), redis1.getPort()));
|
||||
shards.add(new JedisShardInfo(redis2.getHost(), redis2.getPort()));
|
||||
shards.get(0).setPassword("foobared");
|
||||
shards.get(1).setPassword("foobared");
|
||||
ShardedJedis jedis = new ShardedJedis(shards);
|
||||
|
||||
final List<String> keys = getKeysDifferentShard(jedis);
|
||||
jedis.set(keys.get(0), "a");
|
||||
jedis.set(keys.get(1), "b");
|
||||
|
||||
assertNotSame(jedis.getShard(keys.get(0)), jedis.getShard(keys.get(1)));
|
||||
|
||||
List<Object> results = jedis.pipelined(new ShardedJedisPipeline() {
|
||||
public void execute() {
|
||||
get(keys.get(0));
|
||||
get(keys.get(1));
|
||||
}
|
||||
});
|
||||
|
||||
List<Object> expected = new ArrayList<Object>(2);
|
||||
expected.add(SafeEncoder.encode("a"));
|
||||
expected.add(SafeEncoder.encode("b"));
|
||||
|
||||
assertEquals(2, results.size());
|
||||
assertArrayEquals(SafeEncoder.encode("a"), (byte[]) results.get(0));
|
||||
assertArrayEquals(SafeEncoder.encode("b"), (byte[]) results.get(1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMD5Sharding() {
|
||||
List<JedisShardInfo> shards = new ArrayList<JedisShardInfo>(3);
|
||||
|
||||
Reference in New Issue
Block a user