Skip to content

Commit

Permalink
upgrade org.redisson:redisson from 3.16.6 to 3.27.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dengliming committed Mar 9, 2024
1 parent bf8fee6 commit b8a1619
Show file tree
Hide file tree
Showing 21 changed files with 110 additions and 112 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright 2024 dengliming.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.github.dengliming.redismodule.common;

import org.redisson.Redisson;
import org.redisson.client.protocol.RedisCommands;
import org.redisson.command.CommandAsyncExecutor;
import org.redisson.config.Config;

public abstract class BaseRedissonClient {
private final Redisson redisson;

protected BaseRedissonClient(Config config) {
this.redisson = (Redisson) Redisson.create(config);
}

public Void flushall() {
CommandAsyncExecutor commandExecutor = redisson.getCommandExecutor();
return commandExecutor.get(commandExecutor.writeAllVoidAsync(RedisCommands.FLUSHALL));
}

public void shutdown() {
redisson.shutdown();
}

public Redisson getRedisson() {
return redisson;
}

public CommandAsyncExecutor getCommandExecutor() {
return redisson.getCommandExecutor();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

package io.github.dengliming.redismodule.common.test;

import org.redisson.Redisson;
import io.github.dengliming.redismodule.common.BaseRedissonClient;
import org.redisson.command.CommandAsyncExecutor;
import org.redisson.config.Config;

public class RedisConditionClient extends Redisson {
public class RedisConditionClient extends BaseRedissonClient {

public RedisConditionClient(Config config) {
super(config);
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<redisson.version>3.16.6</redisson.version>
<redisson.version>3.27.1</redisson.version>
<junit.version>5.6.2</junit.version>
<java.version>1.8</java.version>
<maven-source-plugin.version>3.0.1</maven-source-plugin.version>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020 dengliming.
* Copyright 2020-2024 dengliming.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -57,7 +57,7 @@ public class RedisAI {

public RedisAI(CommandAsyncExecutor commandExecutor) {
this.commandExecutor = commandExecutor;
this.codec = commandExecutor.getConnectionManager().getCodec();
this.codec = commandExecutor.getServiceManager().getCfg().getCodec();
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020 dengliming.
* Copyright 2020-2024 dengliming.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,17 +16,14 @@

package io.github.dengliming.redismodule.redisai.client;

import io.github.dengliming.redismodule.common.BaseRedissonClient;
import io.github.dengliming.redismodule.redisai.RedisAI;
import org.redisson.Redisson;
import org.redisson.client.protocol.RedisCommands;
import org.redisson.command.CommandAsyncExecutor;
import org.redisson.config.Config;

/**
* @author dengliming
*/
public class RedisAIClient extends Redisson {

public class RedisAIClient extends BaseRedissonClient {
public RedisAIClient(Config config) {
super(config);
}
Expand All @@ -35,8 +32,4 @@ public RedisAI getRedisAI() {
return new RedisAI(getCommandExecutor());
}

public Void flushall() {
CommandAsyncExecutor commandExecutor = getCommandExecutor();
return commandExecutor.get(commandExecutor.writeAllAsync(RedisCommands.FLUSHALL));
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020 dengliming.
* Copyright 2020-2024 dengliming.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -52,7 +52,7 @@ public BloomFilter(Codec codec, CommandAsyncExecutor commandExecutor, String nam
}

public BloomFilter(CommandAsyncExecutor commandExecutor, String name) {
this(commandExecutor.getConnectionManager().getCodec(), commandExecutor, name);
this(commandExecutor.getServiceManager().getCfg().getCodec(), commandExecutor, name);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020 dengliming.
* Copyright 2020-2024 dengliming.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -46,7 +46,7 @@ public CountMinSketch(Codec codec, CommandAsyncExecutor commandExecutor, String
}

public CountMinSketch(CommandAsyncExecutor commandExecutor, String name) {
this(commandExecutor.getConnectionManager().getCodec(), commandExecutor, name);
this(commandExecutor.getServiceManager().getCfg().getCodec(), commandExecutor, name);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020 dengliming.
* Copyright 2020-2024 dengliming.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -52,7 +52,7 @@ public CuckooFilter(Codec codec, CommandAsyncExecutor commandExecutor, String na
}

public CuckooFilter(CommandAsyncExecutor commandExecutor, String name) {
this(commandExecutor.getConnectionManager().getCodec(), commandExecutor, name);
this(commandExecutor.getServiceManager().getCfg().getCodec(), commandExecutor, name);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2022 dengliming.
* Copyright 2021-2024 dengliming.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -51,7 +51,7 @@ public TDigest(Codec codec, CommandAsyncExecutor commandExecutor, String name) {
}

public TDigest(CommandAsyncExecutor commandExecutor, String name) {
this(commandExecutor.getConnectionManager().getCodec(), commandExecutor, name);
this(commandExecutor.getServiceManager().getCfg().getCodec(), commandExecutor, name);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020 dengliming.
* Copyright 2020-2024 dengliming.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -42,7 +42,7 @@
public class TopKFilter extends RedissonObject {

public TopKFilter(CommandAsyncExecutor commandExecutor, String name) {
this(commandExecutor.getConnectionManager().getCodec(), commandExecutor, name);
this(commandExecutor.getServiceManager().getCfg().getCodec(), commandExecutor, name);
}

public TopKFilter(Codec codec, CommandAsyncExecutor commandExecutor, String name) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020 dengliming.
* Copyright 2020-2024 dengliming.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,20 +16,18 @@

package io.github.dengliming.redismodule.redisbloom.client;

import io.github.dengliming.redismodule.common.BaseRedissonClient;
import io.github.dengliming.redismodule.redisbloom.BloomFilter;
import io.github.dengliming.redismodule.redisbloom.CountMinSketch;
import io.github.dengliming.redismodule.redisbloom.CuckooFilter;
import io.github.dengliming.redismodule.redisbloom.TDigest;
import io.github.dengliming.redismodule.redisbloom.TopKFilter;
import org.redisson.Redisson;
import org.redisson.client.protocol.RedisCommands;
import org.redisson.command.CommandAsyncExecutor;
import org.redisson.config.Config;

/**
* @author dengliming
*/
public class RedisBloomClient extends Redisson {
public class RedisBloomClient extends BaseRedissonClient {

public RedisBloomClient(Config config) {
super(config);
Expand All @@ -54,9 +52,4 @@ public TopKFilter getTopKFilter(String name) {
public TDigest getTDigest(String name) {
return new TDigest(getCommandExecutor(), name);
}

public Void flushall() {
CommandAsyncExecutor commandExecutor = getCommandExecutor();
return commandExecutor.get(commandExecutor.writeAllAsync(RedisCommands.FLUSHALL));
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2022 dengliming.
* Copyright 2020-2024 dengliming.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -92,7 +92,7 @@ public RediSearch(Codec codec, CommandAsyncExecutor commandExecutor, String name
}

public RediSearch(CommandAsyncExecutor commandExecutor, String name) {
this(commandExecutor.getConnectionManager().getCodec(), commandExecutor, name);
this(commandExecutor.getServiceManager().getCfg().getCodec(), commandExecutor, name);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020 dengliming.
* Copyright 2020-2024 dengliming.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,16 +16,14 @@

package io.github.dengliming.redismodule.redisearch.client;

import io.github.dengliming.redismodule.common.BaseRedissonClient;
import io.github.dengliming.redismodule.redisearch.RediSearch;
import org.redisson.Redisson;
import org.redisson.client.protocol.RedisCommands;
import org.redisson.command.CommandAsyncExecutor;
import org.redisson.config.Config;

/**
* @author dengliming
*/
public class RediSearchClient extends Redisson {
public class RediSearchClient extends BaseRedissonClient {

public RediSearchClient(Config config) {
super(config);
Expand All @@ -34,9 +32,4 @@ public RediSearchClient(Config config) {
public RediSearch getRediSearch(String name) {
return new RediSearch(getCommandExecutor(), name);
}

public Void flushall() {
CommandAsyncExecutor commandExecutor = getCommandExecutor();
return commandExecutor.get(commandExecutor.writeAllAsync(RedisCommands.FLUSHALL));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public void testAddHash() {
assertThat(rediSearch.createIndex(new Schema().addField(new TextField("title")))).isTrue();
Map<String, Object> fields = new HashMap<>();
fields.put("title", "hello world");
RMap<String, Object> map = getRediSearchClient().getMap("foo");
RMap<String, Object> map = getRediSearchClient().getRedisson().getMap("foo");
map.putAll(fields);
assertThat(rediSearch.addHash("foo", 1, RSLanguage.ENGLISH)).isTrue();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021 dengliming.
* Copyright 2021-2024 dengliming.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,13 +16,11 @@

package io.github.dengliming.redismodule.redisgears.client;

import io.github.dengliming.redismodule.common.BaseRedissonClient;
import io.github.dengliming.redismodule.redisgears.RedisGears;
import org.redisson.Redisson;
import org.redisson.client.protocol.RedisCommands;
import org.redisson.command.CommandAsyncExecutor;
import org.redisson.config.Config;

public class RedisGearsClient extends Redisson {
public class RedisGearsClient extends BaseRedissonClient {

public RedisGearsClient(Config config) {
super(config);
Expand All @@ -31,9 +29,4 @@ public RedisGearsClient(Config config) {
public RedisGears getRedisGears() {
return new RedisGears(getCommandExecutor());
}

public Void flushall() {
CommandAsyncExecutor commandExecutor = getCommandExecutor();
return commandExecutor.get(commandExecutor.writeAllAsync(RedisCommands.FLUSHALL));
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 dengliming.
* Copyright 2022-2024 dengliming.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -44,7 +44,7 @@ public class RedisGraph {
private final Codec codec;

public RedisGraph(CommandAsyncExecutor commandExecutor) {
this(commandExecutor, commandExecutor.getConnectionManager().getCodec());
this(commandExecutor, commandExecutor.getServiceManager().getCfg().getCodec());
}

public RedisGraph(CommandAsyncExecutor commandExecutor, Codec codec) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 dengliming.
* Copyright 2022-2024 dengliming.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,15 +16,13 @@

package io.github.dengliming.redismodule.redisgraph.client;

import io.github.dengliming.redismodule.common.BaseRedissonClient;
import io.github.dengliming.redismodule.redisgraph.RedisGraph;
import io.github.dengliming.redismodule.redisgraph.RedisGraphBatch;
import org.redisson.Redisson;
import org.redisson.api.BatchOptions;
import org.redisson.client.protocol.RedisCommands;
import org.redisson.command.CommandAsyncExecutor;
import org.redisson.config.Config;

public class RedisGraphClient extends Redisson {
public class RedisGraphClient extends BaseRedissonClient {

public RedisGraphClient(Config config) {
super(config);
Expand All @@ -41,9 +39,4 @@ public RedisGraphBatch createRedisGraphBatch() {
public RedisGraphBatch createRedisGraphBatch(BatchOptions options) {
return new RedisGraphBatch(getCommandExecutor(), options);
}

public Void flushall() {
CommandAsyncExecutor commandExecutor = getCommandExecutor();
return commandExecutor.get(commandExecutor.writeAllAsync(RedisCommands.FLUSHALL));
}
}
Loading

0 comments on commit b8a1619

Please sign in to comment.