BAEL-4325: Upgrade reddison to 3.13.1 (#9588)

* BAEL-4325: Upgrade reddison to 3.13.1

* BAEL-4325: Add jedis.version property
This commit is contained in:
kwoyke 2020-06-28 06:57:16 +02:00 committed by GitHub
parent 74bf53586c
commit 68d0783c37
7 changed files with 28 additions and 24 deletions

View File

@ -33,7 +33,7 @@
<dependency> <dependency>
<groupId>redis.clients</groupId> <groupId>redis.clients</groupId>
<artifactId>jedis</artifactId> <artifactId>jedis</artifactId>
<version>${redisson.version}</version> <version>${jedis.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.kstyrc</groupId> <groupId>com.github.kstyrc</groupId>
@ -48,12 +48,19 @@
<dependency> <dependency>
<groupId>io.lettuce</groupId> <groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId> <artifactId>lettuce-core</artifactId>
</dependency> </dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<version>${epoll.version}</version>
</dependency>
</dependencies> </dependencies>
<properties> <properties>
<embedded-redis.version>0.6</embedded-redis.version> <embedded-redis.version>0.6</embedded-redis.version>
<redisson.version>3.3.0</redisson.version> <redisson.version>3.13.1</redisson.version>
<jedis.version>3.3.0</jedis.version>
<epoll.version>4.1.50.Final</epoll.version>
</properties> </properties>
</project> </project>

View File

@ -1,9 +1,11 @@
package com.baeldung; package com.baeldung;
import java.io.Serializable;
/** /**
* Created by johnson on 3/9/17. * Created by johnson on 3/9/17.
*/ */
public class CustomMessage { public class CustomMessage implements Serializable {
private String message; private String message;
public CustomMessage() { public CustomMessage() {

View File

@ -1,6 +1,8 @@
package com.baeldung; package com.baeldung;
public class Ledger { import java.io.Serializable;
public class Ledger implements Serializable {
public Ledger() { public Ledger() {
} }

View File

@ -1,13 +1,10 @@
{ {
"singleServerConfig": { "singleServerConfig": {
"idleConnectionTimeout": 10000, "idleConnectionTimeout": 10000,
"pingTimeout": 1000,
"connectTimeout": 10000, "connectTimeout": 10000,
"timeout": 3000, "timeout": 3000,
"retryAttempts": 3, "retryAttempts": 3,
"retryInterval": 1500, "retryInterval": 1500,
"reconnectionTimeout": 3000,
"failedAttempts": 3,
"password": null, "password": null,
"subscriptionsPerConnection": 5, "subscriptionsPerConnection": 5,
"clientName": null, "clientName": null,
@ -17,11 +14,9 @@
"connectionMinimumIdleSize": 10, "connectionMinimumIdleSize": 10,
"connectionPoolSize": 64, "connectionPoolSize": 64,
"database": 0, "database": 0,
"dnsMonitoring": false,
"dnsMonitoringInterval": 5000 "dnsMonitoringInterval": 5000
}, },
"threads": 0, "threads": 0,
"nettyThreads": 0, "nettyThreads": 0,
"codec": null, "codec": null
"useLinuxNativeEpoll": false
} }

View File

@ -1,12 +1,9 @@
singleServerConfig: singleServerConfig:
idleConnectionTimeout: 10000 idleConnectionTimeout: 10000
pingTimeout: 1000
connectTimeout: 10000 connectTimeout: 10000
timeout: 3000 timeout: 3000
retryAttempts: 3 retryAttempts: 3
retryInterval: 1500 retryInterval: 1500
reconnectionTimeout: 3000
failedAttempts: 3
password: null password: null
subscriptionsPerConnection: 5 subscriptionsPerConnection: 5
clientName: null clientName: null
@ -16,9 +13,7 @@ singleServerConfig:
connectionMinimumIdleSize: 10 connectionMinimumIdleSize: 10
connectionPoolSize: 64 connectionPoolSize: 64
database: 0 database: 0
dnsMonitoring: false
dnsMonitoringInterval: 5000 dnsMonitoringInterval: 5000
threads: 0 threads: 0
nettyThreads: 0 nettyThreads: 0
codec: !<org.redisson.codec.JsonJacksonCodec> {} codec: !<org.redisson.codec.JsonJacksonCodec> {}
useLinuxNativeEpoll: false

View File

@ -48,7 +48,7 @@ public class RedissonConfigurationIntegrationTest {
public void givenJavaConfig_thenRedissonConnectToRedis() { public void givenJavaConfig_thenRedissonConnectToRedis() {
Config config = new Config(); Config config = new Config();
config.useSingleServer() config.useSingleServer()
.setAddress(String.format("127.0.0.1:%s", port)); .setAddress(String.format("redis://127.0.0.1:%s", port));
client = Redisson.create(config); client = Redisson.create(config);

View File

@ -7,6 +7,7 @@ import org.redisson.Redisson;
import org.redisson.RedissonMultiLock; import org.redisson.RedissonMultiLock;
import org.redisson.api.*; import org.redisson.api.*;
import org.redisson.client.RedisClient; import org.redisson.client.RedisClient;
import org.redisson.client.RedisClientConfig;
import org.redisson.client.RedisConnection; import org.redisson.client.RedisConnection;
import org.redisson.client.codec.StringCodec; import org.redisson.client.codec.StringCodec;
import org.redisson.client.protocol.RedisCommands; import org.redisson.client.protocol.RedisCommands;
@ -103,10 +104,10 @@ public class RedissonIntegrationTest {
public void givenTopicSubscribedToAChannel_thenReceiveMessageFromChannel() throws ExecutionException, InterruptedException { public void givenTopicSubscribedToAChannel_thenReceiveMessageFromChannel() throws ExecutionException, InterruptedException {
CompletableFuture<String> future = new CompletableFuture<>(); CompletableFuture<String> future = new CompletableFuture<>();
RTopic<CustomMessage> subscribeTopic = client.getTopic("baeldung"); RTopic subscribeTopic = client.getTopic("baeldung");
subscribeTopic.addListener((channel, customMessage) -> future.complete(customMessage.getMessage())); subscribeTopic.addListener(CustomMessage.class, (channel, customMessage) -> future.complete(customMessage.getMessage()));
RTopic<CustomMessage> publishTopic = client.getTopic("baeldung"); RTopic publishTopic = client.getTopic("baeldung");
long clientsReceivedMessage long clientsReceivedMessage
= publishTopic.publish(new CustomMessage("This is a message")); = publishTopic.publish(new CustomMessage("This is a message"));
@ -203,10 +204,10 @@ public class RedissonIntegrationTest {
batch.getMap("ledgerMap").fastPutAsync("1", "2"); batch.getMap("ledgerMap").fastPutAsync("1", "2");
batch.getMap("ledgerMap").putAsync("2", "5"); batch.getMap("ledgerMap").putAsync("2", "5");
List<?> result = batch.execute(); BatchResult<?> batchResult = batch.execute();
RMap<String, String> map = client.getMap("ledgerMap"); RMap<String, String> map = client.getMap("ledgerMap");
assertTrue(result.size() > 0 && map.get("1").equals("2")); assertTrue(batchResult.getResponses().size() > 0 && map.get("1").equals("2"));
} }
@Test @Test
@ -220,7 +221,9 @@ public class RedissonIntegrationTest {
@Test @Test
public void givenLowLevelRedisCommands_thenExecuteLowLevelCommandsOnRedis(){ public void givenLowLevelRedisCommands_thenExecuteLowLevelCommandsOnRedis(){
RedisClient client = new RedisClient("localhost", 6379); RedisClientConfig redisClientConfig = new RedisClientConfig();
redisClientConfig.setAddress("localhost", 6379);
RedisClient client = RedisClient.create(redisClientConfig);
RedisConnection conn = client.connect(); RedisConnection conn = client.connect();
conn.sync(StringCodec.INSTANCE, RedisCommands.SET, "test", 0); conn.sync(StringCodec.INSTANCE, RedisCommands.SET, "test", 0);