public class Config extends Object
Modifier and Type | Method and Description |
---|---|
static Config |
fromJSON(File file)
Read config object stored in JSON format from
File |
static Config |
fromJSON(InputStream inputStream)
Read config object stored in JSON format from
InputStream |
static Config |
fromJSON(Reader reader)
Read config object stored in JSON format from
Reader |
static Config |
fromJSON(String content)
Read config object stored in JSON format from
String |
static Config |
fromJSON(URL url)
Read config object stored in JSON format from
URL |
static Config |
fromYAML(File file)
Read config object stored in YAML format from
File |
static Config |
fromYAML(InputStream inputStream)
Read config object stored in YAML format from
InputStream |
static Config |
fromYAML(Reader reader)
Read config object stored in YAML format from
Reader |
static Config |
fromYAML(String content)
Read config object stored in YAML format from
String |
static Config |
fromYAML(URL url)
Read config object stored in YAML format from
URL |
Codec |
getCodec() |
CodecProvider |
getCodecProvider()
Returns the CodecProvider instance
|
io.netty.channel.EventLoopGroup |
getEventLoopGroup() |
ExecutorService |
getExecutor() |
int |
getNettyThreads() |
ResolverProvider |
getResolverProvider()
Returns the ResolverProvider instance
|
int |
getThreads() |
boolean |
isClusterConfig() |
boolean |
isRedissonReferenceEnabled()
Config option indicate whether Redisson Reference feature is enabled.
|
boolean |
isUseLinuxNativeEpoll() |
Config |
setCodec(Codec codec)
Redis key/value codec.
|
Config |
setCodecProvider(CodecProvider codecProvider)
For codec registry and look up.
|
Config |
setEventLoopGroup(io.netty.channel.EventLoopGroup eventLoopGroup)
Use external EventLoopGroup.
|
Config |
setExecutor(ExecutorService executor)
Use external ExecutorService.
|
Config |
setNettyThreads(int nettyThreads)
Threads amount shared between all redis clients used by Redisson.
|
void |
setRedissonReferenceEnabled(boolean redissonReferenceEnabled)
Config option for enabling Redisson Reference feature
Default value is
true |
Config |
setResolverProvider(ResolverProvider resolverProvider)
For resolver registry and look up.
|
Config |
setThreads(int threads)
Threads amount shared across all listeners of
RTopic object,
invocation handlers of RRemoteService object
and RExecutorService tasks. |
Config |
setUseLinuxNativeEpoll(boolean useLinuxNativeEpoll)
Activates an unix socket if servers binded to loopback interface.
|
String |
toJSON()
Convert current configuration to JSON format
|
String |
toYAML()
Convert current configuration to YAML format
|
ClusterServersConfig |
useClusterServers()
Init cluster servers configuration
|
ElasticacheServersConfig |
useElasticacheServers()
Deprecated.
|
MasterSlaveServersConfig |
useMasterSlaveServers()
Init master/slave servers configuration.
|
ReplicatedServersConfig |
useReplicatedServers()
Init Replicated servers configuration.
|
SentinelServersConfig |
useSentinelServers()
Init sentinel servers configuration.
|
SingleServerConfig |
useSingleServer()
Init single server configuration.
|
public Config()
public Config(Config oldConf)
public Config setCodec(Codec codec)
codec
- objectCodec
public Codec getCodec()
public Config setCodecProvider(CodecProvider codecProvider)
codecProvider
- objectCodecProvider
public CodecProvider getCodecProvider()
public Config setResolverProvider(ResolverProvider resolverProvider)
resolverProvider
- objectpublic ResolverProvider getResolverProvider()
public boolean isRedissonReferenceEnabled()
Default value is true
true
if Redisson Reference feature enabledpublic void setRedissonReferenceEnabled(boolean redissonReferenceEnabled)
Default value is true
redissonReferenceEnabled
- flagpublic ClusterServersConfig useClusterServers()
@Deprecated public ElasticacheServersConfig useElasticacheServers()
public ReplicatedServersConfig useReplicatedServers()
public SingleServerConfig useSingleServer()
public SentinelServersConfig useSentinelServers()
public MasterSlaveServersConfig useMasterSlaveServers()
public boolean isClusterConfig()
public int getThreads()
public Config setThreads(int threads)
RTopic
object,
invocation handlers of RRemoteService
object
and RExecutorService
tasks.
Default is 0
.
0
means current_processors_amount * 2
threads
- amountpublic Config setUseLinuxNativeEpoll(boolean useLinuxNativeEpoll)
useLinuxNativeEpoll
- flagpublic boolean isUseLinuxNativeEpoll()
public Config setNettyThreads(int nettyThreads)
Default is 0
.
0
means current_processors_amount * 2
nettyThreads
- amountpublic int getNettyThreads()
public Config setExecutor(ExecutorService executor)
RTopic
,
RRemoteService
invocation handlers
and RExecutorService
tasks.
The caller is responsible for closing the ExecutorService.
executor
- objectpublic ExecutorService getExecutor()
public Config setEventLoopGroup(io.netty.channel.EventLoopGroup eventLoopGroup)
Only EpollEventLoopGroup
or
NioEventLoopGroup
can be used.
The caller is responsible for closing the EventLoopGroup.
eventLoopGroup
- objectpublic io.netty.channel.EventLoopGroup getEventLoopGroup()
public static Config fromJSON(String content) throws IOException
String
content
- of configIOException
- errorpublic static Config fromJSON(InputStream inputStream) throws IOException
InputStream
inputStream
- objectIOException
- errorpublic static Config fromJSON(File file) throws IOException
File
file
- objectIOException
- errorpublic static Config fromJSON(URL url) throws IOException
URL
url
- objectIOException
- errorpublic static Config fromJSON(Reader reader) throws IOException
Reader
reader
- objectIOException
- errorpublic String toJSON() throws IOException
IOException
- errorpublic static Config fromYAML(String content) throws IOException
String
content
- of configIOException
- errorpublic static Config fromYAML(InputStream inputStream) throws IOException
InputStream
inputStream
- objectIOException
- errorpublic static Config fromYAML(File file) throws IOException
File
file
- objectIOException
- errorpublic static Config fromYAML(URL url) throws IOException
URL
url
- objectIOException
- errorpublic static Config fromYAML(Reader reader) throws IOException
Reader
reader
- objectIOException
- errorpublic String toYAML() throws IOException
IOException
- errorCopyright © 2014–2017 The Redisson Project. All rights reserved.