获取锁,等待自己释放,或者已释放都会出现‘远程主机关闭一个连接’
redis-starter 2.1.5.RELEASE
redisson 3.11.1
eg:1
Redisson配置singleServerConfig: address: "redis://127.0.0.1:6379" password: null clientName: null database: 7 #选择使用哪个数据库0~15 idleConnectionTimeout: 10000 pingTimeout: 1000 connectTimeout: 10000 timeout: 3000 retryAttempts: 3 retryInterval: 1500 reconnectionTimeout: 3000 failedAttempts: 3 subscriptionsPerConnection: 5 subscriptionConnectionMinimumIdleSize: 1 subscriptionConnectionPoolSize: 50 connectionMinimumIdleSize: 32 connectionPoolSize: 64 dnsMonitoringInterval: 5000
dnsMonitoring: falsethreads: 0 nettyThreads: 0 codec: class: "org.redisson.codec.KryoCodec" transportMode: "NIO"
创建方式
@Bean
public RedissonClient redisson() throws IOException {
// 本例子使用的是yaml格式的配置文件,读取使用Config.fromYAML,如果是Json文件,则使用Config.fromJSON
Config config = Config.fromYAML(RedissonManager.class.getClassLoader().getResource("redisson/redisson-dev.yml"));
return Redisson.create(config);
}
eg :2
@Bean
// public RedissonClient getRedisson(){
// List
直接使用这个方式创建,,同样都报了同样的错误