|
24 | 24 | import java.util.List;
|
25 | 25 | import java.util.Map.Entry;
|
26 | 26 | import java.util.Properties;
|
| 27 | +import java.util.concurrent.TimeUnit; |
27 | 28 |
|
28 | 29 | import org.springframework.dao.InvalidDataAccessApiUsageException;
|
29 | 30 | import org.springframework.data.redis.connection.ClusterCommandExecutor.MultiNodeResult;
|
@@ -391,24 +392,26 @@ public void resetConfigStats(RedisClusterNode node) {
|
391 | 392 |
|
392 | 393 | /*
|
393 | 394 | * (non-Javadoc)
|
394 |
| - * @see org.springframework.data.redis.connection.RedisServerCommands#time() |
| 395 | + * @see org.springframework.data.redis.connection.RedisServerCommands#time(TimeUnit) |
395 | 396 | */
|
396 | 397 | @Override
|
397 |
| - public Long time() { |
| 398 | + public Long time(TimeUnit timeUnit) { |
398 | 399 |
|
399 | 400 | return convertListOfStringToTime(connection.getClusterCommandExecutor()
|
400 |
| - .executeCommandOnArbitraryNode((JedisClusterCommandCallback<List<String>>) BinaryJedis::time).getValue()); |
| 401 | + .executeCommandOnArbitraryNode((JedisClusterCommandCallback<List<String>>) BinaryJedis::time).getValue(), |
| 402 | + timeUnit); |
401 | 403 | }
|
402 | 404 |
|
403 | 405 | /*
|
404 | 406 | * (non-Javadoc)
|
405 |
| - * @see org.springframework.data.redis.connection.RedisClusterServerCommands#time(org.springframework.data.redis.connection.RedisClusterNode) |
| 407 | + * @see org.springframework.data.redis.connection.RedisClusterServerCommands#time(org.springframework.data.redis.connection.RedisClusterNode, TimeUnit) |
406 | 408 | */
|
407 | 409 | @Override
|
408 |
| - public Long time(RedisClusterNode node) { |
| 410 | + public Long time(RedisClusterNode node, TimeUnit timeUnit) { |
409 | 411 |
|
410 | 412 | return convertListOfStringToTime(connection.getClusterCommandExecutor()
|
411 |
| - .executeCommandOnSingleNode((JedisClusterCommandCallback<List<String>>) BinaryJedis::time, node).getValue()); |
| 413 | + .executeCommandOnSingleNode((JedisClusterCommandCallback<List<String>>) BinaryJedis::time, node).getValue(), |
| 414 | + timeUnit); |
412 | 415 | }
|
413 | 416 |
|
414 | 417 | /*
|
@@ -517,13 +520,13 @@ public void migrate(byte[] key, RedisNode target, int dbIndex, @Nullable Migrate
|
517 | 520 | node);
|
518 | 521 | }
|
519 | 522 |
|
520 |
| - private Long convertListOfStringToTime(List<String> serverTimeInformation) { |
| 523 | + private Long convertListOfStringToTime(List<String> serverTimeInformation, TimeUnit timeUnit) { |
521 | 524 |
|
522 | 525 | Assert.notEmpty(serverTimeInformation, "Received invalid result from server. Expected 2 items in collection.");
|
523 | 526 | Assert.isTrue(serverTimeInformation.size() == 2,
|
524 | 527 | "Received invalid number of arguments from redis server. Expected 2 received " + serverTimeInformation.size());
|
525 | 528 |
|
526 |
| - return Converters.toTimeMillis(serverTimeInformation.get(0), serverTimeInformation.get(1)); |
| 529 | + return Converters.toTimeMillis(serverTimeInformation.get(0), serverTimeInformation.get(1), timeUnit); |
527 | 530 | }
|
528 | 531 |
|
529 | 532 | private <T> NodeResult<T> executeCommandOnSingleNode(JedisClusterCommandCallback<T> cmd, RedisClusterNode node) {
|
|
0 commit comments