Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_57962205
redisson
提交
38323722
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,体验更适合开发者的 AI 搜索 >>
提交
38323722
编写于
5月 19, 2021
作者:
N
Nikita Koksharov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed - RedissonNode unable to start due to ClassNotFoundException #3621
上级
dc475437
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
141 addition
and
90 deletion
+141
-90
redisson/src/main/java/org/redisson/RedissonNode.java
redisson/src/main/java/org/redisson/RedissonNode.java
+14
-3
redisson/src/main/java/org/redisson/config/RedissonNodeConfig.java
...src/main/java/org/redisson/config/RedissonNodeConfig.java
+2
-87
redisson/src/main/java/org/redisson/config/RedissonNodeFileConfig.java
...main/java/org/redisson/config/RedissonNodeFileConfig.java
+125
-0
未找到文件。
redisson/src/main/java/org/redisson/RedissonNode.java
浏览文件 @
38323722
...
...
@@ -28,6 +28,7 @@ import org.redisson.api.RedissonClient;
import
org.redisson.api.WorkerOptions
;
import
org.redisson.client.RedisConnection
;
import
org.redisson.config.RedissonNodeConfig
;
import
org.redisson.config.RedissonNodeFileConfig
;
import
org.redisson.connection.ConnectionManager
;
import
org.redisson.connection.MasterSlaveEntry
;
import
org.slf4j.Logger
;
...
...
@@ -86,13 +87,13 @@ public final class RedissonNode {
}
String
configPath
=
args
[
0
];
RedissonNodeConfig
config
=
null
;
RedissonNode
File
Config
config
=
null
;
try
{
config
=
RedissonNodeConfig
.
fromJSON
(
new
File
(
configPath
));
config
=
RedissonNode
File
Config
.
fromJSON
(
new
File
(
configPath
));
}
catch
(
IOException
e
)
{
// trying next format
try
{
config
=
RedissonNodeConfig
.
fromYAML
(
new
File
(
configPath
));
config
=
RedissonNode
File
Config
.
fromYAML
(
new
File
(
configPath
));
}
catch
(
IOException
e1
)
{
log
.
error
(
"Can't parse json config "
+
configPath
,
e
);
throw
new
IllegalArgumentException
(
"Can't parse yaml config "
+
configPath
,
e1
);
...
...
@@ -198,6 +199,16 @@ public final class RedissonNode {
return
create
(
config
,
null
);
}
/**
* Create Redisson node instance with provided config
*
* @param config of RedissonNode
* @return RedissonNode instance
*/
public
static
RedissonNode
create
(
RedissonNodeFileConfig
config
)
{
return
create
(
new
RedissonNodeConfig
(
config
),
null
);
}
/**
* Create Redisson node instance with provided config and Redisson instance
*
...
...
redisson/src/main/java/org/redisson/config/RedissonNodeConfig.java
浏览文件 @
38323722
...
...
@@ -15,12 +15,6 @@
*/
package
org.redisson.config
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.redisson.api.RedissonNodeInitializer
;
import
org.springframework.beans.factory.BeanFactory
;
/**
...
...
@@ -29,13 +23,10 @@ import org.springframework.beans.factory.BeanFactory;
* @author Nikita Koksharov
*
*/
public
class
RedissonNodeConfig
extends
Config
{
public
class
RedissonNodeConfig
extends
RedissonNodeFile
Config
{
private
int
mapReduceWorkers
=
0
;
private
RedissonNodeInitializer
redissonNodeInitializer
;
private
BeanFactory
beanFactory
;
private
Map
<
String
,
Integer
>
executorServiceWorkers
=
new
HashMap
<
String
,
Integer
>();
public
RedissonNodeConfig
()
{
super
();
}
...
...
@@ -46,61 +37,9 @@ public class RedissonNodeConfig extends Config {
public
RedissonNodeConfig
(
RedissonNodeConfig
oldConf
)
{
super
(
oldConf
);
this
.
executorServiceWorkers
=
new
HashMap
<
String
,
Integer
>(
oldConf
.
executorServiceWorkers
);
this
.
redissonNodeInitializer
=
oldConf
.
redissonNodeInitializer
;
this
.
mapReduceWorkers
=
oldConf
.
mapReduceWorkers
;
this
.
beanFactory
=
oldConf
.
beanFactory
;
}
/**
* MapReduce workers amount.
* <p>
* <code>0 = current_processors_amount</code>
* <p>
* <code>-1 = disable MapReduce workers</code>
*
* <p>
* Default is <code>0</code>
*
* @param mapReduceWorkers workers for MapReduce
* @return config
*/
public
RedissonNodeConfig
setMapReduceWorkers
(
int
mapReduceWorkers
)
{
this
.
mapReduceWorkers
=
mapReduceWorkers
;
return
this
;
}
public
int
getMapReduceWorkers
()
{
return
mapReduceWorkers
;
}
/**
* Executor service workers amount per service name
*
* @param workers mapping
* @return config
*/
public
RedissonNodeConfig
setExecutorServiceWorkers
(
Map
<
String
,
Integer
>
workers
)
{
this
.
executorServiceWorkers
=
workers
;
return
this
;
}
public
Map
<
String
,
Integer
>
getExecutorServiceWorkers
()
{
return
executorServiceWorkers
;
}
/**
* Redisson node initializer
*
* @param redissonNodeInitializer object
* @return config
*/
public
RedissonNodeConfig
setRedissonNodeInitializer
(
RedissonNodeInitializer
redissonNodeInitializer
)
{
this
.
redissonNodeInitializer
=
redissonNodeInitializer
;
return
this
;
}
public
RedissonNodeInitializer
getRedissonNodeInitializer
()
{
return
redissonNodeInitializer
;
}
public
BeanFactory
getBeanFactory
()
{
return
beanFactory
;
}
...
...
@@ -115,28 +54,4 @@ public class RedissonNodeConfig extends Config {
this
.
beanFactory
=
beanFactory
;
}
/**
* Read config object stored in JSON format from <code>File</code>
*
* @param file object
* @return config
* @throws IOException error
*/
public
static
RedissonNodeConfig
fromJSON
(
File
file
)
throws
IOException
{
ConfigSupport
support
=
new
ConfigSupport
();
return
support
.
fromJSON
(
file
,
RedissonNodeConfig
.
class
);
}
/**
* Read config object stored in YAML format from <code>File</code>
*
* @param file object
* @return config
* @throws IOException error
*/
public
static
RedissonNodeConfig
fromYAML
(
File
file
)
throws
IOException
{
ConfigSupport
support
=
new
ConfigSupport
();
return
support
.
fromYAML
(
file
,
RedissonNodeConfig
.
class
);
}
}
redisson/src/main/java/org/redisson/config/RedissonNodeFileConfig.java
0 → 100644
浏览文件 @
38323722
/**
* Copyright (c) 2013-2021 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.config
;
import
org.redisson.api.RedissonNodeInitializer
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* Redisson Node file configuration
*
* @author Nikita Koksharov
*
*/
public
class
RedissonNodeFileConfig
extends
Config
{
private
int
mapReduceWorkers
=
0
;
private
RedissonNodeInitializer
redissonNodeInitializer
;
private
Map
<
String
,
Integer
>
executorServiceWorkers
=
new
HashMap
<>();
public
RedissonNodeFileConfig
()
{
super
();
}
public
RedissonNodeFileConfig
(
Config
oldConf
)
{
super
(
oldConf
);
}
public
RedissonNodeFileConfig
(
RedissonNodeFileConfig
oldConf
)
{
super
(
oldConf
);
this
.
executorServiceWorkers
=
new
HashMap
<>(
oldConf
.
executorServiceWorkers
);
this
.
redissonNodeInitializer
=
oldConf
.
redissonNodeInitializer
;
this
.
mapReduceWorkers
=
oldConf
.
mapReduceWorkers
;
}
/**
* MapReduce workers amount.
* <p>
* <code>0 = current_processors_amount</code>
* <p>
* <code>-1 = disable MapReduce workers</code>
*
* <p>
* Default is <code>0</code>
*
* @param mapReduceWorkers workers for MapReduce
* @return config
*/
public
RedissonNodeFileConfig
setMapReduceWorkers
(
int
mapReduceWorkers
)
{
this
.
mapReduceWorkers
=
mapReduceWorkers
;
return
this
;
}
public
int
getMapReduceWorkers
()
{
return
mapReduceWorkers
;
}
/**
* Executor service workers amount per service name
*
* @param workers mapping
* @return config
*/
public
RedissonNodeFileConfig
setExecutorServiceWorkers
(
Map
<
String
,
Integer
>
workers
)
{
this
.
executorServiceWorkers
=
workers
;
return
this
;
}
public
Map
<
String
,
Integer
>
getExecutorServiceWorkers
()
{
return
executorServiceWorkers
;
}
/**
* Redisson node initializer
*
* @param redissonNodeInitializer object
* @return config
*/
public
RedissonNodeFileConfig
setRedissonNodeInitializer
(
RedissonNodeInitializer
redissonNodeInitializer
)
{
this
.
redissonNodeInitializer
=
redissonNodeInitializer
;
return
this
;
}
public
RedissonNodeInitializer
getRedissonNodeInitializer
()
{
return
redissonNodeInitializer
;
}
/**
* Read config object stored in JSON format from <code>File</code>
*
* @param file object
* @return config
* @throws IOException error
*/
public
static
RedissonNodeFileConfig
fromJSON
(
File
file
)
throws
IOException
{
ConfigSupport
support
=
new
ConfigSupport
();
return
support
.
fromJSON
(
file
,
RedissonNodeFileConfig
.
class
);
}
/**
* Read config object stored in YAML format from <code>File</code>
*
* @param file object
* @return config
* @throws IOException error
*/
public
static
RedissonNodeFileConfig
fromYAML
(
File
file
)
throws
IOException
{
ConfigSupport
support
=
new
ConfigSupport
();
return
support
.
fromYAML
(
file
,
RedissonNodeFileConfig
.
class
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录