Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_57962205
redisson
提交
1afd7b94
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,发现更多精彩内容 >>
提交
1afd7b94
编写于
12月 25, 2018
作者:
N
Nikita Koksharov
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into 3.0.0
上级
dbb39905
ca97559c
变更
12
显示空白变更内容
内联
并排
Showing
12 changed file
with
305 addition
and
12 deletion
+305
-12
redisson-hibernate/redisson-hibernate-4/src/main/java/org/redisson/hibernate/JndiRedissonRegionFactory.java
...ava/org/redisson/hibernate/JndiRedissonRegionFactory.java
+70
-0
redisson-hibernate/redisson-hibernate-4/src/main/java/org/redisson/hibernate/RedissonRegionFactory.java
...in/java/org/redisson/hibernate/RedissonRegionFactory.java
+2
-0
redisson-hibernate/redisson-hibernate-5/src/main/java/org/redisson/hibernate/JndiRedissonRegionFactory.java
...ava/org/redisson/hibernate/JndiRedissonRegionFactory.java
+70
-0
redisson-hibernate/redisson-hibernate-5/src/main/java/org/redisson/hibernate/RedissonRegionFactory.java
...in/java/org/redisson/hibernate/RedissonRegionFactory.java
+3
-2
redisson-hibernate/redisson-hibernate-52/pom.xml
redisson-hibernate/redisson-hibernate-52/pom.xml
+8
-0
redisson-hibernate/redisson-hibernate-52/src/main/java/org/redisson/hibernate/JndiRedissonRegionFactory.java
...ava/org/redisson/hibernate/JndiRedissonRegionFactory.java
+70
-0
redisson-hibernate/redisson-hibernate-52/src/main/java/org/redisson/hibernate/RedissonRegionFactory.java
...in/java/org/redisson/hibernate/RedissonRegionFactory.java
+2
-0
redisson-hibernate/redisson-hibernate-53/src/main/java/org/redisson/hibernate/JndiRedissonRegionFactory.java
...ava/org/redisson/hibernate/JndiRedissonRegionFactory.java
+71
-0
redisson-hibernate/redisson-hibernate-53/src/main/java/org/redisson/hibernate/RedissonRegionFactory.java
...in/java/org/redisson/hibernate/RedissonRegionFactory.java
+2
-0
redisson/src/main/java/org/redisson/client/handler/CommandDecoder.java
...main/java/org/redisson/client/handler/CommandDecoder.java
+1
-1
redisson/src/main/java/org/redisson/command/CommandBatchService.java
...c/main/java/org/redisson/command/CommandBatchService.java
+3
-7
redisson/src/main/java/org/redisson/config/Config.java
redisson/src/main/java/org/redisson/config/Config.java
+3
-2
未找到文件。
redisson-hibernate/redisson-hibernate-4/src/main/java/org/redisson/hibernate/JndiRedissonRegionFactory.java
0 → 100644
浏览文件 @
1afd7b94
/**
* Copyright 2018 Nikita Koksharov
*
* 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
org.redisson.hibernate
;
import
java.util.Properties
;
import
javax.naming.InitialContext
;
import
javax.naming.NamingException
;
import
org.hibernate.cache.CacheException
;
import
org.hibernate.internal.util.config.ConfigurationHelper
;
import
org.hibernate.internal.util.jndi.JndiHelper
;
import
org.redisson.api.RedissonClient
;
/**
* Hibernate Cache region factory based on Redisson.
* Uses Redisson instance located in JNDI.
*
* @author Nikita Koksharov
*
*/
public
class
JndiRedissonRegionFactory
extends
RedissonRegionFactory
{
private
static
final
long
serialVersionUID
=
-
4814502675083325567L
;
public
static
final
String
JNDI_NAME
=
CONFIG_PREFIX
+
"jndi_name"
;
@Override
protected
RedissonClient
createRedissonClient
(
Properties
properties
)
{
String
jndiName
=
ConfigurationHelper
.
getString
(
JNDI_NAME
,
properties
);
if
(
jndiName
==
null
)
{
throw
new
CacheException
(
JNDI_NAME
+
" property not set"
);
}
Properties
jndiProperties
=
JndiHelper
.
extractJndiProperties
(
properties
);
InitialContext
context
=
null
;
try
{
context
=
new
InitialContext
(
jndiProperties
);
return
(
RedissonClient
)
context
.
lookup
(
jndiName
);
}
catch
(
NamingException
e
)
{
throw
new
CacheException
(
"Unable to locate Redisson instances by "
+
jndiName
,
e
);
}
finally
{
if
(
context
!=
null
)
{
try
{
context
.
close
();
}
catch
(
NamingException
e
)
{
throw
new
CacheException
(
"Unable to close JNDI context"
,
e
);
}
}
}
}
@Override
public
void
stop
()
{
}
}
redisson-hibernate/redisson-hibernate-4/src/main/java/org/redisson/hibernate/RedissonRegionFactory.java
浏览文件 @
1afd7b94
...
...
@@ -46,6 +46,8 @@ import org.redisson.hibernate.region.RedissonQueryRegion;
import
org.redisson.hibernate.region.RedissonTimestampsRegion
;
/**
* Hibernate Cache region factory based on Redisson.
* Creates own Redisson instance during region start.
*
* @author Nikita Koksharov
*
...
...
redisson-hibernate/redisson-hibernate-5/src/main/java/org/redisson/hibernate/JndiRedissonRegionFactory.java
0 → 100644
浏览文件 @
1afd7b94
/**
* Copyright 2018 Nikita Koksharov
*
* 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
org.redisson.hibernate
;
import
java.util.Properties
;
import
javax.naming.InitialContext
;
import
javax.naming.NamingException
;
import
org.hibernate.cache.CacheException
;
import
org.hibernate.internal.util.config.ConfigurationHelper
;
import
org.hibernate.internal.util.jndi.JndiHelper
;
import
org.redisson.api.RedissonClient
;
/**
* Hibernate Cache region factory based on Redisson.
* Uses Redisson instance located in JNDI.
*
* @author Nikita Koksharov
*
*/
public
class
JndiRedissonRegionFactory
extends
RedissonRegionFactory
{
private
static
final
long
serialVersionUID
=
-
4814502675083325567L
;
public
static
final
String
JNDI_NAME
=
CONFIG_PREFIX
+
"jndi_name"
;
@Override
protected
RedissonClient
createRedissonClient
(
Properties
properties
)
{
String
jndiName
=
ConfigurationHelper
.
getString
(
JNDI_NAME
,
properties
);
if
(
jndiName
==
null
)
{
throw
new
CacheException
(
JNDI_NAME
+
" property not set"
);
}
Properties
jndiProperties
=
JndiHelper
.
extractJndiProperties
(
properties
);
InitialContext
context
=
null
;
try
{
context
=
new
InitialContext
(
jndiProperties
);
return
(
RedissonClient
)
context
.
lookup
(
jndiName
);
}
catch
(
NamingException
e
)
{
throw
new
CacheException
(
"Unable to locate Redisson instances by "
+
jndiName
,
e
);
}
finally
{
if
(
context
!=
null
)
{
try
{
context
.
close
();
}
catch
(
NamingException
e
)
{
throw
new
CacheException
(
"Unable to close JNDI context"
,
e
);
}
}
}
}
@Override
public
void
stop
()
{
}
}
redisson-hibernate/redisson-hibernate-5/src/main/java/org/redisson/hibernate/RedissonRegionFactory.java
浏览文件 @
1afd7b94
...
...
@@ -47,11 +47,12 @@ import org.redisson.hibernate.region.RedissonQueryRegion;
import
org.redisson.hibernate.region.RedissonTimestampsRegion
;
/**
* Hibernate Cache region factory based on Redisson.
* Creates own Redisson instance during region start.
*
* @author Nikita Koksharov
*
*/
public
class
RedissonRegionFactory
implements
RegionFactory
{
*/
public
class
RedissonRegionFactory
implements
RegionFactory
{
private
static
final
Logger
log
=
Logger
.
getLogger
(
RedissonRegionFactory
.
class
);
...
...
redisson-hibernate/redisson-hibernate-52/pom.xml
浏览文件 @
1afd7b94
...
...
@@ -36,6 +36,14 @@
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-context
</artifactId>
<version>
[3.1,5.0)
</version>
<scope>
provided
</scope>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
javax.xml.bind
</groupId>
<artifactId>
jaxb-api
</artifactId>
...
...
redisson-hibernate/redisson-hibernate-52/src/main/java/org/redisson/hibernate/JndiRedissonRegionFactory.java
0 → 100644
浏览文件 @
1afd7b94
/**
* Copyright 2018 Nikita Koksharov
*
* 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
org.redisson.hibernate
;
import
java.util.Properties
;
import
javax.naming.InitialContext
;
import
javax.naming.NamingException
;
import
org.hibernate.cache.CacheException
;
import
org.hibernate.internal.util.config.ConfigurationHelper
;
import
org.hibernate.internal.util.jndi.JndiHelper
;
import
org.redisson.api.RedissonClient
;
/**
* Hibernate Cache region factory based on Redisson.
* Uses Redisson instance located in JNDI.
*
* @author Nikita Koksharov
*
*/
public
class
JndiRedissonRegionFactory
extends
RedissonRegionFactory
{
private
static
final
long
serialVersionUID
=
-
4814502675083325567L
;
public
static
final
String
JNDI_NAME
=
CONFIG_PREFIX
+
"jndi_name"
;
@Override
protected
RedissonClient
createRedissonClient
(
Properties
properties
)
{
String
jndiName
=
ConfigurationHelper
.
getString
(
JNDI_NAME
,
properties
);
if
(
jndiName
==
null
)
{
throw
new
CacheException
(
JNDI_NAME
+
" property not set"
);
}
Properties
jndiProperties
=
JndiHelper
.
extractJndiProperties
(
properties
);
InitialContext
context
=
null
;
try
{
context
=
new
InitialContext
(
jndiProperties
);
return
(
RedissonClient
)
context
.
lookup
(
jndiName
);
}
catch
(
NamingException
e
)
{
throw
new
CacheException
(
"Unable to locate Redisson instances by "
+
jndiName
,
e
);
}
finally
{
if
(
context
!=
null
)
{
try
{
context
.
close
();
}
catch
(
NamingException
e
)
{
throw
new
CacheException
(
"Unable to close JNDI context"
,
e
);
}
}
}
}
@Override
public
void
stop
()
{
}
}
redisson-hibernate/redisson-hibernate-52/src/main/java/org/redisson/hibernate/RedissonRegionFactory.java
浏览文件 @
1afd7b94
...
...
@@ -47,6 +47,8 @@ import org.redisson.hibernate.region.RedissonQueryRegion;
import
org.redisson.hibernate.region.RedissonTimestampsRegion
;
/**
* Hibernate Cache region factory based on Redisson.
* Creates own Redisson instance during region start.
*
* @author Nikita Koksharov
*
...
...
redisson-hibernate/redisson-hibernate-53/src/main/java/org/redisson/hibernate/JndiRedissonRegionFactory.java
0 → 100644
浏览文件 @
1afd7b94
/**
* Copyright 2018 Nikita Koksharov
*
* 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
org.redisson.hibernate
;
import
java.util.Map
;
import
java.util.Properties
;
import
javax.naming.InitialContext
;
import
javax.naming.NamingException
;
import
org.hibernate.cache.CacheException
;
import
org.hibernate.internal.util.config.ConfigurationHelper
;
import
org.hibernate.internal.util.jndi.JndiHelper
;
import
org.redisson.api.RedissonClient
;
/**
* Hibernate Cache region factory based on Redisson.
* Uses Redisson instance located in JNDI.
*
* @author Nikita Koksharov
*
*/
public
class
JndiRedissonRegionFactory
extends
RedissonRegionFactory
{
private
static
final
long
serialVersionUID
=
-
4814502675083325567L
;
public
static
final
String
JNDI_NAME
=
CONFIG_PREFIX
+
"jndi_name"
;
@Override
protected
RedissonClient
createRedissonClient
(
Map
properties
)
{
String
jndiName
=
ConfigurationHelper
.
getString
(
JNDI_NAME
,
properties
);
if
(
jndiName
==
null
)
{
throw
new
CacheException
(
JNDI_NAME
+
" property not set"
);
}
Properties
jndiProperties
=
JndiHelper
.
extractJndiProperties
(
properties
);
InitialContext
context
=
null
;
try
{
context
=
new
InitialContext
(
jndiProperties
);
return
(
RedissonClient
)
context
.
lookup
(
jndiName
);
}
catch
(
NamingException
e
)
{
throw
new
CacheException
(
"Unable to locate Redisson instances by "
+
jndiName
,
e
);
}
finally
{
if
(
context
!=
null
)
{
try
{
context
.
close
();
}
catch
(
NamingException
e
)
{
throw
new
CacheException
(
"Unable to close JNDI context"
,
e
);
}
}
}
}
@Override
protected
void
releaseFromUse
()
{
}
}
redisson-hibernate/redisson-hibernate-53/src/main/java/org/redisson/hibernate/RedissonRegionFactory.java
浏览文件 @
1afd7b94
...
...
@@ -41,6 +41,8 @@ import org.redisson.client.codec.LongCodec;
import
org.redisson.config.Config
;
/**
* Hibernate Cache region factory based on Redisson.
* Creates own Redisson instance during region start.
*
* @author Nikita Koksharov
*
...
...
redisson/src/main/java/org/redisson/client/handler/CommandDecoder.java
浏览文件 @
1afd7b94
...
...
@@ -332,7 +332,7 @@ public class CommandDecoder extends ReplayingDecoder<State> {
handleResult
(
data
,
parts
,
result
,
false
,
channel
);
}
else
if
(
code
==
'*'
)
{
long
size
=
readLong
(
in
);
final
List
<
Object
>
respParts
=
new
ArrayList
<
Object
>();
final
List
<
Object
>
respParts
=
new
ArrayList
<
Object
>(
Math
.
max
((
int
)
size
,
0
)
);
StateLevel
lastLevel
=
null
;
if
(
state
().
isMakeCheckpoint
())
{
...
...
redisson/src/main/java/org/redisson/command/CommandBatchService.java
浏览文件 @
1afd7b94
...
...
@@ -154,9 +154,6 @@ public class CommandBatchService extends CommandAsyncService {
@Override
public
<
V
,
R
>
void
async
(
boolean
readOnlyMode
,
NodeSource
nodeSource
,
Codec
codec
,
RedisCommand
<
V
>
command
,
Object
[]
params
,
RPromise
<
R
>
mainPromise
,
int
attempt
,
boolean
ignoreRedirect
)
{
if
(
executed
.
get
())
{
throw
new
IllegalStateException
(
"Batch already has been executed!"
);
}
if
(
nodeSource
.
getEntry
()
!=
null
)
{
Entry
entry
=
commands
.
get
(
nodeSource
.
getEntry
());
if
(
entry
==
null
)
{
...
...
@@ -471,11 +468,10 @@ public class CommandBatchService extends CommandAsyncService {
});
}
executed
.
set
(
true
);
mainPromise
.
addListener
(
new
FutureListener
<
Map
<
MasterSlaveEntry
,
List
<
Object
>>>()
{
@Override
public
void
operationComplete
(
Future
<
Map
<
MasterSlaveEntry
,
List
<
Object
>>>
future
)
throws
Exception
{
executed
.
set
(
true
);
if
(!
future
.
isSuccess
())
{
resultPromise
.
tryFailure
(
future
.
cause
());
return
;
...
...
@@ -525,8 +521,6 @@ public class CommandBatchService extends CommandAsyncService {
return
resultPromise
;
}
executed
.
set
(
true
);
if
(
this
.
options
.
getExecutionMode
()
!=
ExecutionMode
.
IN_MEMORY
)
{
for
(
Entry
entry
:
commands
.
values
())
{
BatchCommandData
<?,
?>
multiCommand
=
new
BatchCommandData
(
RedisCommands
.
MULTI
,
new
Object
[]
{},
index
.
incrementAndGet
());
...
...
@@ -560,6 +554,7 @@ public class CommandBatchService extends CommandAsyncService {
@Override
public
void
operationComplete
(
Future
<
Void
>
future
)
throws
Exception
{
// commands = null;
executed
.
set
(
true
);
nestedServices
.
clear
();
}
});
...
...
@@ -569,6 +564,7 @@ public class CommandBatchService extends CommandAsyncService {
voidPromise
.
addListener
(
new
FutureListener
<
Void
>()
{
@Override
public
void
operationComplete
(
Future
<
Void
>
future
)
throws
Exception
{
executed
.
set
(
true
);
if
(!
future
.
isSuccess
())
{
promise
.
tryFailure
(
future
.
cause
());
commands
=
null
;
...
...
redisson/src/main/java/org/redisson/config/Config.java
浏览文件 @
1afd7b94
...
...
@@ -111,8 +111,7 @@ public class Config {
if
(
oldConf
.
getCodec
()
==
null
)
{
// use it by default
oldConf
.
setCodec
(
new
JsonJacksonCodec
());
// oldConf.setCodec(new FstCodec());
oldConf
.
setCodec
(
new
FstCodec
());
}
setUseScriptCache
(
oldConf
.
isUseScriptCache
());
...
...
@@ -583,6 +582,8 @@ public class Config {
* <p>
* This prevents against infinity locked locks due to Redisson client crush or
* any other reason when lock can't be released in proper way.
* <p>
* Default is 30000 milliseconds
*
* @param lockWatchdogTimeout timeout in milliseconds
* @return config
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录