Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_57962205
redisson
提交
653bc674
R
redisson
项目概览
weixin_57962205
/
redisson
与 Fork 源项目一致
从无法访问的项目Fork
通知
10
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
redisson
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
653bc674
编写于
10月 27, 2020
作者:
N
Nikita Koksharov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed - MOVED redirection loop if "rediss://" scheme used in configuration #3162
上级
559c2866
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
27 addition
and
21 deletion
+27
-21
redisson/src/main/java/org/redisson/client/RedisAskException.java
.../src/main/java/org/redisson/client/RedisAskException.java
+3
-1
redisson/src/main/java/org/redisson/client/RedisMovedException.java
...rc/main/java/org/redisson/client/RedisMovedException.java
+3
-1
redisson/src/main/java/org/redisson/client/RedisRedirectException.java
...main/java/org/redisson/client/RedisRedirectException.java
+2
-2
redisson/src/main/java/org/redisson/client/handler/CommandDecoder.java
...main/java/org/redisson/client/handler/CommandDecoder.java
+6
-5
redisson/src/main/java/org/redisson/client/handler/CommandPubSubDecoder.java
...ava/org/redisson/client/handler/CommandPubSubDecoder.java
+11
-10
redisson/src/main/java/org/redisson/client/handler/RedisChannelInitializer.java
.../org/redisson/client/handler/RedisChannelInitializer.java
+2
-2
未找到文件。
redisson/src/main/java/org/redisson/client/RedisAskException.java
浏览文件 @
653bc674
...
...
@@ -15,6 +15,8 @@
*/
package
org.redisson.client
;
import
org.redisson.misc.RedisURI
;
/**
*
* @author Nikita Koksharov
...
...
@@ -24,7 +26,7 @@ public class RedisAskException extends RedisRedirectException {
private
static
final
long
serialVersionUID
=
-
6969734163155547631L
;
public
RedisAskException
(
int
slot
,
String
url
)
{
public
RedisAskException
(
int
slot
,
RedisURI
url
)
{
super
(
slot
,
url
);
}
...
...
redisson/src/main/java/org/redisson/client/RedisMovedException.java
浏览文件 @
653bc674
...
...
@@ -15,6 +15,8 @@
*/
package
org.redisson.client
;
import
org.redisson.misc.RedisURI
;
/**
*
* @author Nikita Koksharov
...
...
@@ -24,7 +26,7 @@ public class RedisMovedException extends RedisRedirectException {
private
static
final
long
serialVersionUID
=
-
6969734163155547631L
;
public
RedisMovedException
(
int
slot
,
String
url
)
{
public
RedisMovedException
(
int
slot
,
RedisURI
url
)
{
super
(
slot
,
url
);
}
...
...
redisson/src/main/java/org/redisson/client/RedisRedirectException.java
浏览文件 @
653bc674
...
...
@@ -29,9 +29,9 @@ public class RedisRedirectException extends RedisException {
private
final
int
slot
;
private
final
RedisURI
url
;
public
RedisRedirectException
(
int
slot
,
String
url
)
{
public
RedisRedirectException
(
int
slot
,
RedisURI
url
)
{
this
.
slot
=
slot
;
this
.
url
=
new
RedisURI
(
"redis://"
+
url
)
;
this
.
url
=
url
;
}
public
int
getSlot
()
{
...
...
redisson/src/main/java/org/redisson/client/handler/CommandDecoder.java
浏览文件 @
653bc674
...
...
@@ -44,6 +44,7 @@ import org.redisson.client.protocol.RedisCommand.ValueType;
import
org.redisson.client.protocol.decoder.MultiDecoder
;
import
org.redisson.misc.LogHelper
;
import
org.redisson.misc.RPromise
;
import
org.redisson.misc.RedisURI
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -67,10 +68,10 @@ public class CommandDecoder extends ReplayingDecoder<State> {
private
static
final
char
LF
=
'\n'
;
private
static
final
char
ZERO
=
'0'
;
final
ExecutorService
executor
;
final
String
scheme
;
public
CommandDecoder
(
ExecutorService
executor
)
{
this
.
executor
=
executor
;
public
CommandDecoder
(
String
scheme
)
{
this
.
scheme
=
scheme
;
}
@Override
...
...
@@ -314,12 +315,12 @@ public class CommandDecoder extends ReplayingDecoder<State> {
String
[]
errorParts
=
error
.
split
(
" "
);
int
slot
=
Integer
.
valueOf
(
errorParts
[
1
]);
String
addr
=
errorParts
[
2
];
data
.
tryFailure
(
new
RedisMovedException
(
slot
,
addr
));
data
.
tryFailure
(
new
RedisMovedException
(
slot
,
new
RedisURI
(
scheme
+
"://"
+
addr
)
));
}
else
if
(
error
.
startsWith
(
"ASK"
))
{
String
[]
errorParts
=
error
.
split
(
" "
);
int
slot
=
Integer
.
valueOf
(
errorParts
[
1
]);
String
addr
=
errorParts
[
2
];
data
.
tryFailure
(
new
RedisAskException
(
slot
,
addr
));
data
.
tryFailure
(
new
RedisAskException
(
slot
,
new
RedisURI
(
scheme
+
"://"
+
addr
)
));
}
else
if
(
error
.
startsWith
(
"TRYAGAIN"
))
{
data
.
tryFailure
(
new
RedisTryAgainException
(
error
+
". channel: "
+
channel
+
" data: "
+
data
));
...
...
redisson/src/main/java/org/redisson/client/handler/CommandPubSubDecoder.java
浏览文件 @
653bc674
...
...
@@ -18,6 +18,7 @@ package org.redisson.client.handler;
import
io.netty.buffer.ByteBuf
;
import
io.netty.channel.Channel
;
import
org.redisson.client.ChannelName
;
import
org.redisson.client.RedisClientConfig
;
import
org.redisson.client.RedisPubSubConnection
;
import
org.redisson.client.codec.ByteArrayCodec
;
import
org.redisson.client.codec.StringCodec
;
...
...
@@ -51,11 +52,11 @@ public class CommandPubSubDecoder extends CommandDecoder {
private
final
Map
<
ChannelName
,
PubSubEntry
>
entries
=
new
HashMap
<>();
private
final
Map
<
PubSubKey
,
CommandData
<
Object
,
Object
>>
commands
=
new
ConcurrentHashMap
<>();
private
final
boolean
keepOrder
;
public
CommandPubSubDecoder
(
ExecutorService
executor
,
boolean
keepOrder
)
{
super
(
executor
);
this
.
keepOrder
=
keepOrder
;
private
final
RedisClientConfig
config
;
public
CommandPubSubDecoder
(
RedisClientConfig
config
)
{
super
(
config
.
getAddress
().
getScheme
()
);
this
.
config
=
config
;
}
public
void
addPubSubCommand
(
ChannelName
channel
,
CommandData
<
Object
,
Object
>
data
)
{
...
...
@@ -96,7 +97,7 @@ public class CommandPubSubDecoder extends CommandDecoder {
protected
void
decodeResult
(
CommandData
<
Object
,
Object
>
data
,
List
<
Object
>
parts
,
Channel
channel
,
Object
result
)
throws
IOException
{
try
{
if
(
executor
.
isShutdown
())
{
if
(
config
.
getExecutor
()
.
isShutdown
())
{
return
;
}
}
catch
(
IllegalStateException
e
)
{
...
...
@@ -123,14 +124,14 @@ public class CommandPubSubDecoder extends CommandDecoder {
channelName
=
((
PubSubPatternMessage
)
result
).
getPattern
();
}
PubSubEntry
entry
=
entries
.
remove
(
channelName
);
if
(
keepOrder
)
{
if
(
config
.
isKeepAlive
()
)
{
enqueueMessage
(
result
,
pubSubConnection
,
entry
);
}
}
}
if
(
keepOrder
)
{
if
(
config
.
isKeepAlive
()
)
{
if
(
result
instanceof
PubSubPatternMessage
)
{
channelName
=
((
PubSubPatternMessage
)
result
).
getPattern
();
}
...
...
@@ -139,7 +140,7 @@ public class CommandPubSubDecoder extends CommandDecoder {
enqueueMessage
(
result
,
pubSubConnection
,
entry
);
}
}
else
{
executor
.
execute
(
new
Runnable
()
{
config
.
getExecutor
()
.
execute
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(
result
instanceof
PubSubStatusMessage
)
{
...
...
@@ -168,7 +169,7 @@ public class CommandPubSubDecoder extends CommandDecoder {
return
;
}
executor
.
execute
(()
->
{
config
.
getExecutor
()
.
execute
(()
->
{
try
{
while
(
true
)
{
Message
result
=
entry
.
getQueue
().
poll
();
...
...
redisson/src/main/java/org/redisson/client/handler/RedisChannelInitializer.java
浏览文件 @
653bc674
...
...
@@ -95,9 +95,9 @@ public class RedisChannelInitializer extends ChannelInitializer<Channel> {
}
if
(
type
==
Type
.
PLAIN
)
{
ch
.
pipeline
().
addLast
(
new
CommandDecoder
(
config
.
get
Executor
()));
ch
.
pipeline
().
addLast
(
new
CommandDecoder
(
config
.
get
Address
().
getScheme
()));
}
else
{
ch
.
pipeline
().
addLast
(
new
CommandPubSubDecoder
(
config
.
getExecutor
(),
config
.
isKeepPubSubOrder
()
));
ch
.
pipeline
().
addLast
(
new
CommandPubSubDecoder
(
config
));
}
ch
.
pipeline
().
addLast
(
new
ErrorsLoggingHandler
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录