public class Config extends Object
Modifier and Type | Method and Description |
---|---|
static Config |
fromJSON(File file)
Deprecated.
|
static Config |
fromJSON(File file,
ClassLoader classLoader)
Deprecated.
|
static Config |
fromJSON(InputStream inputStream)
Deprecated.
|
static Config |
fromJSON(Reader reader)
Deprecated.
|
static Config |
fromJSON(String content)
Deprecated.
|
static Config |
fromJSON(URL url)
Deprecated.
|
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() |
int |
getCleanUpKeysAmount() |
Codec |
getCodec() |
io.netty.channel.EventLoopGroup |
getEventLoopGroup() |
ExecutorService |
getExecutor() |
long |
getLockWatchdogTimeout() |
int |
getMaxCleanUpDelay() |
int |
getMinCleanUpDelay() |
NettyHook |
getNettyHook() |
int |
getNettyThreads() |
int |
getThreads() |
TransportMode |
getTransportMode() |
boolean |
isClusterConfig() |
boolean |
isDecodeInExecutor() |
boolean |
isKeepPubSubOrder() |
boolean |
isReferenceEnabled()
Config option indicate whether Redisson Reference feature is enabled.
|
boolean |
isSentinelConfig() |
boolean |
isUseScriptCache() |
boolean |
isUseThreadClassLoader() |
Config |
setAddressResolverGroupFactory(AddressResolverGroupFactory addressResolverGroupFactory)
Used to switch between
DnsAddressResolverGroup implementations. |
Config |
setCleanUpKeysAmount(int cleanUpKeysAmount)
Defines expired keys amount deleted per single operation during clean up process of expired entries.
|
Config |
setCodec(Codec codec)
Redis key/value codec.
|
Config |
setDecodeInExecutor(boolean decodeInExecutor)
Deprecated.
|
Config |
setEventLoopGroup(io.netty.channel.EventLoopGroup eventLoopGroup)
Use external EventLoopGroup.
|
Config |
setExecutor(ExecutorService executor)
Use external ExecutorService.
|
Config |
setKeepPubSubOrder(boolean keepPubSubOrder)
Defines whether to 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 |
setMaxCleanUpDelay(int maxCleanUpDelay)
Defines maximum delay in seconds for clean up process of expired entries.
|
Config |
setMinCleanUpDelay(int minCleanUpDelay)
Defines minimum delay in seconds for clean up process of expired entries.
|
Config |
setNettyHook(NettyHook nettyHook)
Netty hook applied to Netty Bootstrap and Channel objects.
|
Config |
setNettyThreads(int nettyThreads)
Threads amount shared between all redis clients used by Redisson.
|
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 |
setUseScriptCache(boolean useScriptCache)
Defines whether to use Lua-script cache on Redis side.
|
Config |
setUseThreadClassLoader(boolean useThreadClassLoader)
Defines whether to supply Thread ContextClassLoader to Codec.
|
String |
toJSON()
Deprecated.
|
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.
|
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 NettyHook getNettyHook()
public Config setNettyHook(NettyHook nettyHook)
nettyHook
- - netty hook objectpublic Config setCodec(Codec codec)
codec
- objectCodec
public Codec getCodec()
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()
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 boolean isSentinelConfig()
public int getThreads()
public Config setThreads(int threads)
RTopic
object,
invocation handlers of RRemoteService
object
and RExecutorService
tasks.
Default is 16
.
0
means current_processors_amount * 2
threads
- amountpublic Config setTransportMode(TransportMode transportMode)
Default is TransportMode.NIO
transportMode
- parampublic TransportMode getTransportMode()
public Config setNettyThreads(int nettyThreads)
Default is 32
.
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.
Default is 30000 milliseconds
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()
@Deprecated public static Config fromJSON(String content) throws IOException
IOException
@Deprecated public static Config fromJSON(InputStream inputStream) throws IOException
IOException
@Deprecated public static Config fromJSON(File file, ClassLoader classLoader) throws IOException
IOException
@Deprecated public static Config fromJSON(File file) throws IOException
IOException
@Deprecated public static Config fromJSON(URL url) throws IOException
IOException
@Deprecated public static Config fromJSON(Reader reader) throws IOException
IOException
@Deprecated public String toJSON() throws IOException
IOException
public 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
- errorpublic Config setUseScriptCache(boolean useScriptCache)
NOTE: readMode
option is not taken into account for such calls
as Redis slave redirects execution of cached Lua-script on Redis master node.
Default is false
.
useScriptCache
- - true
if Lua-script caching is required, false
otherwise.public boolean isUseScriptCache()
public boolean isDecodeInExecutor()
@Deprecated public Config setDecodeInExecutor(boolean decodeInExecutor)
codec
in executor's threads or netty's threads.
If decoding data process takes long time and netty thread is used then `RedisTimeoutException` could arise time to time.
Default is false
.
decodeInExecutor
- - true
to use executor's threads, false
to use netty's threads.public int getMinCleanUpDelay()
public Config setMinCleanUpDelay(int minCleanUpDelay)
Applied to JCache, RSetCache, RMapCache, RListMultimapCache, RSetMultimapCache objects.
Default is 5
.
minCleanUpDelay
- - delay in secondspublic int getMaxCleanUpDelay()
public Config setMaxCleanUpDelay(int maxCleanUpDelay)
Applied to JCache, RSetCache, RMapCache, RListMultimapCache, RSetMultimapCache objects.
Default is 1800
.
maxCleanUpDelay
- - delay in secondspublic int getCleanUpKeysAmount()
public Config setCleanUpKeysAmount(int cleanUpKeysAmount)
Applied to JCache, RSetCache, RMapCache, RListMultimapCache, RSetMultimapCache objects.
Default is 100
.
cleanUpKeysAmount
- - delay in secondspublic boolean isUseThreadClassLoader()
public Config setUseThreadClassLoader(boolean useThreadClassLoader)
Default is true
.
useThreadClassLoader
- true
if Thread ContextClassLoader is used, false
otherwise.Copyright © 2014–2020 Redisson. All rights reserved.