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(File file,
ClassLoader classLoader)
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(File file,
ClassLoader classLoader) |
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 |
AddressResolverGroupFactory |
getAddressResolverGroupFactory() |
Codec |
getCodec() |
io.netty.channel.EventLoopGroup |
getEventLoopGroup() |
ExecutorService |
getExecutor() |
long |
getLockWatchdogTimeout() |
int |
getNettyThreads() |
ReferenceCodecProvider |
getReferenceCodecProvider()
Returns the CodecProvider instance
|
int |
getThreads() |
TransportMode |
getTransportMode() |
boolean |
isClusterConfig() |
boolean |
isKeepPubSubOrder() |
boolean |
isReferenceEnabled()
Config option indicate whether Redisson Reference feature is enabled.
|
boolean |
isUseLinuxNativeEpoll() |
Config |
setAddressResolverGroupFactory(AddressResolverGroupFactory addressResolverGroupFactory)
Used to switch between
DnsAddressResolverGroup implementations. |
Config |
setCodec(Codec codec)
Redis key/value codec.
|
Config |
setEventLoopGroup(io.netty.channel.EventLoopGroup eventLoopGroup)
Use external EventLoopGroup.
|
Config |
setExecutor(ExecutorService executor)
Use external ExecutorService.
|
Config |
setKeepPubSubOrder(boolean keepPubSubOrder)
Defines whether keep PubSub messages handling in arrival order
or handle messages concurrently.
|
Config |
setLockWatchdogTimeout(long lockWatchdogTimeout)
This parameter is only used if lock has been acquired without leaseTimeout parameter definition.
|
Config |
setNettyThreads(int nettyThreads)
Threads amount shared between all redis clients used by Redisson.
|
Config |
setReferenceCodecProvider(ReferenceCodecProvider codecProvider)
Reference objects codec provider used for codec registry and look up.
|
void |
setReferenceEnabled(boolean redissonReferenceEnabled)
Config option for enabling Redisson Reference feature
Default value is
true |
Config |
setThreads(int threads)
Threads amount shared across all listeners of
RTopic object,
invocation handlers of RRemoteService object
and RExecutorService tasks. |
Config |
setTransportMode(TransportMode transportMode)
Transport mode
Default is
TransportMode.NIO |
Config |
setUseLinuxNativeEpoll(boolean useLinuxNativeEpoll)
Deprecated.
|
String |
toJSON()
Convert current configuration to JSON format
|
String |
toYAML()
Convert current configuration to YAML format
|
ClusterServersConfig |
useClusterServers()
Init cluster servers configuration
|
void |
useCustomServers(ConnectionManager connectionManager)
This is an extension point to supply custom connection manager.
|
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 setReferenceCodecProvider(ReferenceCodecProvider codecProvider)
org.redisson.codec.DefaultReferenceCodecProvider
used by default.codecProvider
- objectReferenceCodecProvider
public ReferenceCodecProvider getReferenceCodecProvider()
public boolean isReferenceEnabled()
Default value is true
true
if Redisson Reference feature enabledpublic void setReferenceEnabled(boolean redissonReferenceEnabled)
Default value is true
redissonReferenceEnabled
- flagpublic ClusterServersConfig useClusterServers()
@Deprecated public ElasticacheServersConfig useElasticacheServers()
public ReplicatedServersConfig useReplicatedServers()
public void useCustomServers(ConnectionManager connectionManager)
connectionManager
- for supplyon how to implement a connection
manager.
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 setTransportMode(TransportMode transportMode)
Default is TransportMode.NIO
transportMode
- parampublic TransportMode getTransportMode()
@Deprecated public Config setUseLinuxNativeEpoll(boolean useLinuxNativeEpoll)
public 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
,
KQueueEventLoopGroup
NioEventLoopGroup
can be used.
The caller is responsible for closing the EventLoopGroup.
eventLoopGroup
- objectpublic io.netty.channel.EventLoopGroup getEventLoopGroup()
public Config setLockWatchdogTimeout(long lockWatchdogTimeout)
lockWatchdogTimeout
if watchdog
didn't extend it to next lockWatchdogTimeout
time interval.
This prevents against infinity locked locks due to Redisson client crush or any other reason when lock can't be released in proper way.
lockWatchdogTimeout
- timeout in millisecondspublic long getLockWatchdogTimeout()
public Config setKeepPubSubOrder(boolean keepPubSubOrder)
This setting applied only for PubSub messages per channel.
Default is true
.
keepPubSubOrder
- - true
if order required, false
otherwise.public boolean isKeepPubSubOrder()
public Config setAddressResolverGroupFactory(AddressResolverGroupFactory addressResolverGroupFactory)
DnsAddressResolverGroup
implementations.
Switch to round robin RoundRobinDnsAddressResolverGroup
when you need to optimize the url resolving.addressResolverGroupFactory
- public AddressResolverGroupFactory getAddressResolverGroupFactory()
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, ClassLoader classLoader) throws IOException
File
file
- objectclassLoader
- class loaderIOException
- 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(File file, ClassLoader classLoader) throws IOException
IOException
public 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–2018 The Redisson Project. All rights reserved.