Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_57962205
redisson
提交
e2690921
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,发现更多精彩内容 >>
提交
e2690921
编写于
12月 20, 2018
作者:
N
Nikita Koksharov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed - RBitSet object couldn't be used as nested object. #1751
上级
60352b84
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
39 addition
and
21 deletion
+39
-21
redisson/src/main/java/org/redisson/RedissonBitSet.java
redisson/src/main/java/org/redisson/RedissonBitSet.java
+1
-1
redisson/src/main/java/org/redisson/RedissonObject.java
redisson/src/main/java/org/redisson/RedissonObject.java
+10
-10
redisson/src/main/java/org/redisson/command/CommandAsyncService.java
...c/main/java/org/redisson/command/CommandAsyncService.java
+2
-7
redisson/src/main/java/org/redisson/liveobject/core/RedissonObjectBuilder.java
...a/org/redisson/liveobject/core/RedissonObjectBuilder.java
+3
-1
redisson/src/main/java/org/redisson/misc/RedissonObjectFactory.java
...rc/main/java/org/redisson/misc/RedissonObjectFactory.java
+6
-2
redisson/src/test/java/org/redisson/RedissonReferenceTest.java
...son/src/test/java/org/redisson/RedissonReferenceTest.java
+17
-0
未找到文件。
redisson/src/main/java/org/redisson/RedissonBitSet.java
浏览文件 @
e2690921
...
@@ -38,7 +38,7 @@ import org.redisson.command.CommandBatchService;
...
@@ -38,7 +38,7 @@ import org.redisson.command.CommandBatchService;
public
class
RedissonBitSet
extends
RedissonExpirable
implements
RBitSet
{
public
class
RedissonBitSet
extends
RedissonExpirable
implements
RBitSet
{
public
RedissonBitSet
(
CommandAsyncExecutor
connectionManager
,
String
name
)
{
public
RedissonBitSet
(
CommandAsyncExecutor
connectionManager
,
String
name
)
{
super
(
connectionManager
,
name
);
super
(
null
,
connectionManager
,
name
);
}
}
@Override
@Override
...
...
redisson/src/main/java/org/redisson/RedissonObject.java
浏览文件 @
e2690921
...
@@ -101,7 +101,7 @@ public abstract class RedissonObject implements RObject {
...
@@ -101,7 +101,7 @@ public abstract class RedissonObject implements RObject {
@Override
@Override
public
RFuture
<
Long
>
sizeInMemoryAsync
()
{
public
RFuture
<
Long
>
sizeInMemoryAsync
()
{
return
commandExecutor
.
writeAsync
(
getName
(),
RedisCommands
.
MEMORY_USAGE
,
getName
());
return
commandExecutor
.
writeAsync
(
getName
(),
StringCodec
.
INSTANCE
,
RedisCommands
.
MEMORY_USAGE
,
getName
());
}
}
public
final
RFuture
<
Long
>
sizeInMemoryAsync
(
List
<
Object
>
keys
)
{
public
final
RFuture
<
Long
>
sizeInMemoryAsync
(
List
<
Object
>
keys
)
{
...
@@ -124,7 +124,7 @@ public abstract class RedissonObject implements RObject {
...
@@ -124,7 +124,7 @@ public abstract class RedissonObject implements RObject {
@Override
@Override
public
RFuture
<
Void
>
renameAsync
(
String
newName
)
{
public
RFuture
<
Void
>
renameAsync
(
String
newName
)
{
return
commandExecutor
.
writeAsync
(
getName
(),
RedisCommands
.
RENAME
,
getName
(),
newName
);
return
commandExecutor
.
writeAsync
(
getName
(),
StringCodec
.
INSTANCE
,
RedisCommands
.
RENAME
,
getName
(),
newName
);
}
}
@Override
@Override
...
@@ -134,7 +134,7 @@ public abstract class RedissonObject implements RObject {
...
@@ -134,7 +134,7 @@ public abstract class RedissonObject implements RObject {
@Override
@Override
public
RFuture
<
Void
>
migrateAsync
(
String
host
,
int
port
,
int
database
,
long
timeout
)
{
public
RFuture
<
Void
>
migrateAsync
(
String
host
,
int
port
,
int
database
,
long
timeout
)
{
return
commandExecutor
.
writeAsync
(
getName
(),
RedisCommands
.
MIGRATE
,
host
,
port
,
getName
(),
database
,
timeout
);
return
commandExecutor
.
writeAsync
(
getName
(),
StringCodec
.
INSTANCE
,
RedisCommands
.
MIGRATE
,
host
,
port
,
getName
(),
database
,
timeout
);
}
}
@Override
@Override
...
@@ -144,7 +144,7 @@ public abstract class RedissonObject implements RObject {
...
@@ -144,7 +144,7 @@ public abstract class RedissonObject implements RObject {
@Override
@Override
public
RFuture
<
Void
>
copyAsync
(
String
host
,
int
port
,
int
database
,
long
timeout
)
{
public
RFuture
<
Void
>
copyAsync
(
String
host
,
int
port
,
int
database
,
long
timeout
)
{
return
commandExecutor
.
writeAsync
(
getName
(),
RedisCommands
.
MIGRATE
,
host
,
port
,
getName
(),
database
,
timeout
,
"COPY"
);
return
commandExecutor
.
writeAsync
(
getName
(),
StringCodec
.
INSTANCE
,
RedisCommands
.
MIGRATE
,
host
,
port
,
getName
(),
database
,
timeout
,
"COPY"
);
}
}
@Override
@Override
...
@@ -154,7 +154,7 @@ public abstract class RedissonObject implements RObject {
...
@@ -154,7 +154,7 @@ public abstract class RedissonObject implements RObject {
@Override
@Override
public
RFuture
<
Boolean
>
moveAsync
(
int
database
)
{
public
RFuture
<
Boolean
>
moveAsync
(
int
database
)
{
return
commandExecutor
.
writeAsync
(
getName
(),
RedisCommands
.
MOVE
,
getName
(),
database
);
return
commandExecutor
.
writeAsync
(
getName
(),
StringCodec
.
INSTANCE
,
RedisCommands
.
MOVE
,
getName
(),
database
);
}
}
@Override
@Override
...
@@ -164,7 +164,7 @@ public abstract class RedissonObject implements RObject {
...
@@ -164,7 +164,7 @@ public abstract class RedissonObject implements RObject {
@Override
@Override
public
RFuture
<
Boolean
>
renamenxAsync
(
String
newName
)
{
public
RFuture
<
Boolean
>
renamenxAsync
(
String
newName
)
{
return
commandExecutor
.
writeAsync
(
getName
(),
RedisCommands
.
RENAMENX
,
getName
(),
newName
);
return
commandExecutor
.
writeAsync
(
getName
(),
StringCodec
.
INSTANCE
,
RedisCommands
.
RENAMENX
,
getName
(),
newName
);
}
}
@Override
@Override
...
@@ -174,7 +174,7 @@ public abstract class RedissonObject implements RObject {
...
@@ -174,7 +174,7 @@ public abstract class RedissonObject implements RObject {
@Override
@Override
public
RFuture
<
Boolean
>
deleteAsync
()
{
public
RFuture
<
Boolean
>
deleteAsync
()
{
return
commandExecutor
.
writeAsync
(
getName
(),
RedisCommands
.
DEL_BOOL
,
getName
());
return
commandExecutor
.
writeAsync
(
getName
(),
StringCodec
.
INSTANCE
,
RedisCommands
.
DEL_BOOL
,
getName
());
}
}
@Override
@Override
...
@@ -184,7 +184,7 @@ public abstract class RedissonObject implements RObject {
...
@@ -184,7 +184,7 @@ public abstract class RedissonObject implements RObject {
@Override
@Override
public
RFuture
<
Boolean
>
unlinkAsync
()
{
public
RFuture
<
Boolean
>
unlinkAsync
()
{
return
commandExecutor
.
writeAsync
(
getName
(),
RedisCommands
.
UNLINK_BOOL
,
getName
());
return
commandExecutor
.
writeAsync
(
getName
(),
StringCodec
.
INSTANCE
,
RedisCommands
.
UNLINK_BOOL
,
getName
());
}
}
@Override
@Override
...
@@ -194,7 +194,7 @@ public abstract class RedissonObject implements RObject {
...
@@ -194,7 +194,7 @@ public abstract class RedissonObject implements RObject {
@Override
@Override
public
RFuture
<
Boolean
>
touchAsync
()
{
public
RFuture
<
Boolean
>
touchAsync
()
{
return
commandExecutor
.
writeAsync
(
getName
(),
codec
,
RedisCommands
.
TOUCH
,
getName
());
return
commandExecutor
.
writeAsync
(
getName
(),
StringCodec
.
INSTANCE
,
RedisCommands
.
TOUCH
,
getName
());
}
}
@Override
@Override
...
@@ -204,7 +204,7 @@ public abstract class RedissonObject implements RObject {
...
@@ -204,7 +204,7 @@ public abstract class RedissonObject implements RObject {
@Override
@Override
public
RFuture
<
Boolean
>
isExistsAsync
()
{
public
RFuture
<
Boolean
>
isExistsAsync
()
{
return
commandExecutor
.
readAsync
(
getName
(),
codec
,
RedisCommands
.
EXISTS
,
getName
());
return
commandExecutor
.
readAsync
(
getName
(),
StringCodec
.
INSTANCE
,
RedisCommands
.
EXISTS
,
getName
());
}
}
@Override
@Override
...
...
redisson/src/main/java/org/redisson/command/CommandAsyncService.java
浏览文件 @
e2690921
...
@@ -1070,12 +1070,7 @@ public class CommandAsyncService implements CommandAsyncExecutor {
...
@@ -1070,12 +1070,7 @@ public class CommandAsyncService implements CommandAsyncExecutor {
}
}
private
<
R
,
V
>
void
handleReference
(
RPromise
<
R
>
mainPromise
,
R
res
)
{
private
<
R
,
V
>
void
handleReference
(
RPromise
<
R
>
mainPromise
,
R
res
)
{
try
{
mainPromise
.
trySuccess
((
R
)
tryHandleReference
(
res
));
mainPromise
.
trySuccess
((
R
)
tryHandleReference
(
res
));
}
catch
(
Exception
e
)
{
//fall back and let other part of the code handle the type conversion.
mainPromise
.
trySuccess
(
res
);
}
}
}
protected
Object
tryHandleReference
(
Object
o
)
{
protected
Object
tryHandleReference
(
Object
o
)
{
...
@@ -1198,7 +1193,7 @@ public class CommandAsyncService implements CommandAsyncExecutor {
...
@@ -1198,7 +1193,7 @@ public class CommandAsyncService implements CommandAsyncExecutor {
}
}
return
RedissonObjectFactory
.
fromReference
(
redissonRx
,
(
RedissonReference
)
res
);
return
RedissonObjectFactory
.
fromReference
(
redissonRx
,
(
RedissonReference
)
res
);
}
catch
(
Exception
exception
)
{
}
catch
(
Exception
exception
)
{
return
res
;
throw
new
IllegalStateException
(
exception
)
;
}
}
}
}
...
...
redisson/src/main/java/org/redisson/liveobject/core/RedissonObjectBuilder.java
浏览文件 @
e2690921
...
@@ -84,7 +84,9 @@ public class RedissonObjectBuilder {
...
@@ -84,7 +84,9 @@ public class RedissonObjectBuilder {
public
void
store
(
RObject
ar
,
String
fieldName
,
RMap
<
String
,
Object
>
liveMap
)
{
public
void
store
(
RObject
ar
,
String
fieldName
,
RMap
<
String
,
Object
>
liveMap
)
{
Codec
codec
=
ar
.
getCodec
();
Codec
codec
=
ar
.
getCodec
();
codecProvider
.
registerCodec
((
Class
)
codec
.
getClass
(),
codec
);
if
(
codec
!=
null
)
{
codecProvider
.
registerCodec
((
Class
)
codec
.
getClass
(),
codec
);
}
liveMap
.
fastPut
(
fieldName
,
liveMap
.
fastPut
(
fieldName
,
new
RedissonReference
(
ar
.
getClass
(),
ar
.
getName
(),
codec
));
new
RedissonReference
(
ar
.
getClass
(),
ar
.
getName
(),
codec
));
}
}
...
...
redisson/src/main/java/org/redisson/misc/RedissonObjectFactory.java
浏览文件 @
e2690921
...
@@ -171,14 +171,18 @@ public class RedissonObjectFactory {
...
@@ -171,14 +171,18 @@ public class RedissonObjectFactory {
Class
<?>
clazz
=
object
.
getClass
().
getInterfaces
()[
0
];
Class
<?>
clazz
=
object
.
getClass
().
getInterfaces
()[
0
];
RObject
rObject
=
((
RObject
)
object
);
RObject
rObject
=
((
RObject
)
object
);
config
.
getReferenceCodecProvider
().
registerCodec
((
Class
)
rObject
.
getCodec
().
getClass
(),
rObject
.
getCodec
());
if
(
rObject
.
getCodec
()
!=
null
)
{
config
.
getReferenceCodecProvider
().
registerCodec
((
Class
)
rObject
.
getCodec
().
getClass
(),
rObject
.
getCodec
());
}
return
new
RedissonReference
(
clazz
,
rObject
.
getName
(),
rObject
.
getCodec
());
return
new
RedissonReference
(
clazz
,
rObject
.
getName
(),
rObject
.
getCodec
());
}
}
if
(
object
instanceof
RObjectReactive
&&
!(
object
instanceof
RLiveObject
))
{
if
(
object
instanceof
RObjectReactive
&&
!(
object
instanceof
RLiveObject
))
{
Class
<?>
clazz
=
object
.
getClass
().
getInterfaces
()[
0
];
Class
<?>
clazz
=
object
.
getClass
().
getInterfaces
()[
0
];
RObjectReactive
rObject
=
((
RObjectReactive
)
object
);
RObjectReactive
rObject
=
((
RObjectReactive
)
object
);
config
.
getReferenceCodecProvider
().
registerCodec
((
Class
)
rObject
.
getCodec
().
getClass
(),
rObject
.
getCodec
());
if
(
rObject
.
getCodec
()
!=
null
)
{
config
.
getReferenceCodecProvider
().
registerCodec
((
Class
)
rObject
.
getCodec
().
getClass
(),
rObject
.
getCodec
());
}
return
new
RedissonReference
(
clazz
,
rObject
.
getName
(),
rObject
.
getCodec
());
return
new
RedissonReference
(
clazz
,
rObject
.
getName
(),
rObject
.
getCodec
());
}
}
...
...
redisson/src/test/java/org/redisson/RedissonReferenceTest.java
浏览文件 @
e2690921
...
@@ -2,8 +2,10 @@ package org.redisson;
...
@@ -2,8 +2,10 @@ package org.redisson;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.*;
import
com.fasterxml.jackson.databind.DeserializationFeature
;
import
com.fasterxml.jackson.databind.DeserializationFeature
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
...
@@ -19,6 +21,21 @@ import org.redisson.config.Config;
...
@@ -19,6 +21,21 @@ import org.redisson.config.Config;
*/
*/
public
class
RedissonReferenceTest
extends
BaseTest
{
public
class
RedissonReferenceTest
extends
BaseTest
{
@Test
public
void
testBitSet
()
{
RMap
<
String
,
RBitSet
>
data
=
redisson
.
getMap
(
"data-00"
);
RBitSet
bs
=
redisson
.
getBitSet
(
"data-01"
);
bs
.
set
(
5
);
bs
.
set
(
7
);
data
.
put
(
"a"
,
bs
);
assertThat
(
data
.
entrySet
()).
hasSize
(
1
);
for
(
Map
.
Entry
<
String
,
RBitSet
>
entry
:
data
.
entrySet
())
{
assertThat
(
entry
.
getValue
().
get
(
5
)).
isTrue
();
assertThat
(
entry
.
getValue
().
get
(
7
)).
isTrue
();
}
}
@Test
@Test
public
void
testBasic
()
{
public
void
testBasic
()
{
RBucket
<
Object
>
b1
=
redisson
.
getBucket
(
"b1"
);
RBucket
<
Object
>
b1
=
redisson
.
getBucket
(
"b1"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录