65
65
import org .springframework .data .redis .core .ScanOptions ;
66
66
import org .springframework .data .redis .core .types .Expiration ;
67
67
import org .springframework .data .redis .core .types .RedisClientInfo ;
68
+ import org .springframework .data .redis .util .ByteUtils ;
68
69
import org .springframework .util .Assert ;
69
70
import org .springframework .util .CollectionUtils ;
70
71
import org .springframework .util .ObjectUtils ;
79
80
* {@link RedisClusterConnection} implementation on top of {@link JedisCluster}.<br/>
80
81
* Uses the native {@link JedisCluster} api where possible and falls back to direct node communication using
81
82
* {@link Jedis} where needed.
82
- *
83
+ *
83
84
* @author Christoph Strobl
84
85
* @author Mark Paluch
85
86
* @since 1.7
@@ -126,7 +127,7 @@ public JedisClusterConnection(JedisCluster cluster) {
126
127
/**
127
128
* Create new {@link JedisClusterConnection} utilizing native connections via {@link JedisCluster} running commands
128
129
* across the cluster via given {@link ClusterCommandExecutor}.
129
- *
130
+ *
130
131
* @param cluster must not be {@literal null}.
131
132
* @param executor must not be {@literal null}.
132
133
*/
@@ -894,7 +895,7 @@ public Long bitCount(byte[] key, long begin, long end) {
894
895
@ Override
895
896
public Long bitOp (BitOperation op , byte [] destination , byte []... keys ) {
896
897
897
- byte [][] allKeys = Converters .mergeArrays (destination , keys );
898
+ byte [][] allKeys = ByteUtils .mergeArrays (destination , keys );
898
899
899
900
if (ClusterSlotHashUtil .isSameSlotForAllKeys (allKeys )) {
900
901
try {
@@ -1332,7 +1333,7 @@ public Set<byte[]> doInCluster(Jedis client, byte[] key) {
1332
1333
@ Override
1333
1334
public Long sInterStore (byte [] destKey , byte []... keys ) {
1334
1335
1335
- byte [][] allKeys = Converters .mergeArrays (destKey , keys );
1336
+ byte [][] allKeys = ByteUtils .mergeArrays (destKey , keys );
1336
1337
1337
1338
if (ClusterSlotHashUtil .isSameSlotForAllKeys (allKeys )) {
1338
1339
try {
@@ -1392,7 +1393,7 @@ public Set<byte[]> doInCluster(Jedis client, byte[] key) {
1392
1393
@ Override
1393
1394
public Long sUnionStore (byte [] destKey , byte []... keys ) {
1394
1395
1395
- byte [][] allKeys = Converters .mergeArrays (destKey , keys );
1396
+ byte [][] allKeys = ByteUtils .mergeArrays (destKey , keys );
1396
1397
1397
1398
if (ClusterSlotHashUtil .isSameSlotForAllKeys (allKeys )) {
1398
1399
try {
@@ -1455,7 +1456,7 @@ public Set<byte[]> doInCluster(Jedis client, byte[] key) {
1455
1456
@ Override
1456
1457
public Long sDiffStore (byte [] destKey , byte []... keys ) {
1457
1458
1458
- byte [][] allKeys = Converters .mergeArrays (destKey , keys );
1459
+ byte [][] allKeys = ByteUtils .mergeArrays (destKey , keys );
1459
1460
1460
1461
if (ClusterSlotHashUtil .isSameSlotForAllKeys (allKeys )) {
1461
1462
try {
@@ -2083,7 +2084,7 @@ public Long zRemRangeByScore(byte[] key, double min, double max) {
2083
2084
@ Override
2084
2085
public Long zUnionStore (byte [] destKey , byte []... sets ) {
2085
2086
2086
- byte [][] allKeys = Converters .mergeArrays (destKey , sets );
2087
+ byte [][] allKeys = ByteUtils .mergeArrays (destKey , sets );
2087
2088
2088
2089
if (ClusterSlotHashUtil .isSameSlotForAllKeys (allKeys )) {
2089
2090
@@ -2104,7 +2105,7 @@ public Long zUnionStore(byte[] destKey, byte[]... sets) {
2104
2105
@ Override
2105
2106
public Long zUnionStore (byte [] destKey , Aggregate aggregate , int [] weights , byte []... sets ) {
2106
2107
2107
- byte [][] allKeys = Converters .mergeArrays (destKey , sets );
2108
+ byte [][] allKeys = ByteUtils .mergeArrays (destKey , sets );
2108
2109
2109
2110
if (ClusterSlotHashUtil .isSameSlotForAllKeys (allKeys )) {
2110
2111
@@ -2123,7 +2124,7 @@ public Long zUnionStore(byte[] destKey, Aggregate aggregate, int[] weights, byte
2123
2124
@ Override
2124
2125
public Long zInterStore (byte [] destKey , byte []... sets ) {
2125
2126
2126
- byte [][] allKeys = Converters .mergeArrays (destKey , sets );
2127
+ byte [][] allKeys = ByteUtils .mergeArrays (destKey , sets );
2127
2128
2128
2129
if (ClusterSlotHashUtil .isSameSlotForAllKeys (allKeys )) {
2129
2130
@@ -2140,7 +2141,7 @@ public Long zInterStore(byte[] destKey, byte[]... sets) {
2140
2141
@ Override
2141
2142
public Long zInterStore (byte [] destKey , Aggregate aggregate , int [] weights , byte []... sets ) {
2142
2143
2143
- byte [][] allKeys = Converters .mergeArrays (destKey , sets );
2144
+ byte [][] allKeys = ByteUtils .mergeArrays (destKey , sets );
2144
2145
2145
2146
if (ClusterSlotHashUtil .isSameSlotForAllKeys (allKeys )) {
2146
2147
@@ -3298,7 +3299,7 @@ public Long pfCount(byte[]... keys) {
3298
3299
@ Override
3299
3300
public void pfMerge (byte [] destinationKey , byte []... sourceKeys ) {
3300
3301
3301
- byte [][] allKeys = Converters .mergeArrays (destinationKey , sourceKeys );
3302
+ byte [][] allKeys = ByteUtils .mergeArrays (destinationKey , sourceKeys );
3302
3303
3303
3304
if (ClusterSlotHashUtil .isSameSlotForAllKeys (allKeys )) {
3304
3305
try {
@@ -3592,6 +3593,7 @@ public List<String> doInCluster(Jedis client) {
3592
3593
* (non-Javadoc)
3593
3594
* @see org.springframework.data.redis.connection.RedisClusterCommands#clusterGetMasterSlaveMap()
3594
3595
*/
3596
+ @ Override
3595
3597
public Map <RedisClusterNode , Collection <RedisClusterNode >> clusterGetMasterSlaveMap () {
3596
3598
3597
3599
List <NodeResult <Collection <RedisClusterNode >>> nodeResults = clusterCommandExecutor
@@ -3753,7 +3755,7 @@ public RedisSentinelConnection getSentinelConnection() {
3753
3755
3754
3756
/**
3755
3757
* {@link Jedis} specific {@link ClusterCommandCallback}.
3756
- *
3758
+ *
3757
3759
* @author Christoph Strobl
3758
3760
* @param <T>
3759
3761
* @since 1.7
@@ -3771,7 +3773,7 @@ protected interface JedisMultiKeyClusterCommandCallback<T> extends MultiKeyClust
3771
3773
3772
3774
/**
3773
3775
* Jedis specific implementation of {@link ClusterNodeResourceProvider}.
3774
- *
3776
+ *
3775
3777
* @author Christoph Strobl
3776
3778
* @since 1.7
3777
3779
*/
@@ -3781,7 +3783,7 @@ static class JedisClusterNodeResourceProvider implements ClusterNodeResourceProv
3781
3783
3782
3784
/**
3783
3785
* Creates new {@link JedisClusterNodeResourceProvider}.
3784
- *
3786
+ *
3785
3787
* @param cluster must not be {@literal null}.
3786
3788
*/
3787
3789
public JedisClusterNodeResourceProvider (JedisCluster cluster ) {
@@ -3829,20 +3831,20 @@ public void returnResourceForSpecificNode(RedisClusterNode node, Object client)
3829
3831
3830
3832
/**
3831
3833
* Jedis specific implementation of {@link ClusterTopologyProvider}.
3832
- *
3834
+ *
3833
3835
* @author Christoph Strobl
3834
3836
* @since 1.7
3835
3837
*/
3836
3838
static class JedisClusterTopologyProvider implements ClusterTopologyProvider {
3837
3839
3838
- private Object lock = new Object ();
3840
+ private final Object lock = new Object ();
3839
3841
private final JedisCluster cluster ;
3840
3842
private long time = 0 ;
3841
3843
private ClusterTopology cached ;
3842
3844
3843
3845
/**
3844
3846
* Create new {@link JedisClusterTopologyProvider}.s
3845
- *
3847
+ *
3846
3848
* @param cluster
3847
3849
*/
3848
3850
public JedisClusterTopologyProvider (JedisCluster cluster ) {
0 commit comments