Class Config
- Direct Known Subclasses:
RedissonNodeFileConfig
- Author:
- Nikita Koksharov
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ConfigDeprecated.static ConfigfromJSON(File file, ClassLoader classLoader) Deprecated.static ConfigfromJSON(InputStream inputStream) Deprecated.static ConfigDeprecated.static ConfigDeprecated.static ConfigDeprecated.static ConfigRead config object stored in YAML format fromFilestatic ConfigfromYAML(File file, ClassLoader classLoader) static ConfigfromYAML(InputStream inputStream) Read config object stored in YAML format fromInputStreamstatic ConfigRead config object stored in YAML format fromReaderstatic ConfigRead config object stored in YAML format fromStringstatic ConfigRead config object stored in YAML format fromURLintprotected ClusterServersConfiggetCodec()io.netty.channel.EventLoopGrouplongprotected MasterSlaveServersConfigintintintlongprotected ReplicatedServersConfigprotected SentinelServersConfigprotected SingleServerConfiglongintbooleanbooleanbooleanbooleanbooleanConfig option indicate whether Redisson Reference feature is enabled.booleanbooleanbooleanbooleansetAddressResolverGroupFactory(AddressResolverGroupFactory addressResolverGroupFactory) Used to switch betweenDnsAddressResolverGroupimplementations.setCheckLockSyncedSlaves(boolean checkLockSyncedSlaves) Defines whether to check synchronized slaves amount with actual slaves amount after lock acquisition.setCleanUpKeysAmount(int cleanUpKeysAmount) Defines expired keys amount deleted per single operation during clean up process of expired entries.protected voidsetClusterServersConfig(ClusterServersConfig clusterServersConfig) Redis data codec.setConnectionListener(ConnectionListener connectionListener) Sets connection listener which is triggered when Redisson connected/disconnected to Redis serversetEventLoopGroup(io.netty.channel.EventLoopGroup eventLoopGroup) Use external EventLoopGroup.setExecutor(ExecutorService executor) Use external ExecutorService.setKeepPubSubOrder(boolean keepPubSubOrder) Defines whether to keep PubSub messages handling in arrival order or handle messages concurrently.setLazyInitialization(boolean lazyInitialization) Defines whether Redisson connects to Redis only when first Redis call is made and not during Redisson instance creation.setLockWatchdogTimeout(long lockWatchdogTimeout) This parameter is only used if lock has been acquired without leaseTimeout parameter definition.protected voidsetMasterSlaveServersConfig(MasterSlaveServersConfig masterSlaveConnectionConfig) setMaxCleanUpDelay(int maxCleanUpDelay) Defines maximum delay in seconds for clean up process of expired entries.setMinCleanUpDelay(int minCleanUpDelay) Defines minimum delay in seconds for clean up process of expired entries.setNettyHook(NettyHook nettyHook) Netty hook applied to Netty Bootstrap and Channel objects.setNettyThreads(int nettyThreads) Threads amount shared between all redis clients used by Redisson.voidsetReferenceEnabled(boolean redissonReferenceEnabled) Config option for enabling Redisson Reference featuresetReliableTopicWatchdogTimeout(long timeout) Reliable Topic subscriber expires aftertimeoutif watchdog didn't extend it to nexttimeouttime interval.protected voidsetReplicatedServersConfig(ReplicatedServersConfig replicatedServersConfig) protected voidsetSentinelServersConfig(SentinelServersConfig sentinelConnectionConfig) protected voidsetSingleServerConfig(SingleServerConfig singleConnectionConfig) setSlavesSyncTimeout(long timeout) Defines slaves synchronization timeout applied to each operation ofRLock,RSemaphore,RPermitExpirableSemaphoreobjects.setThreads(int threads) Threads amount shared across all listeners ofRTopicobject, invocation handlers ofRRemoteServiceobject andRExecutorServicetasks.setTransportMode(TransportMode transportMode) Transport modesetUseScriptCache(boolean useScriptCache) Defines whether to use Lua-script cache on Redis side.setUseThreadClassLoader(boolean useThreadClassLoader) Defines whether to supply Thread ContextClassLoader to Codec.toJSON()Deprecated.toYAML()Convert current configuration to YAML formatInit cluster servers configurationvoiduseCustomServers(ConnectionManager connectionManager) Deprecated.Init master/slave servers configuration.Init Replicated servers configuration.Init sentinel servers configuration.Init single server configuration.
-
Constructor Details
-
Config
public Config() -
Config
-
-
Method Details
-
getNettyHook
-
setNettyHook
Netty hook applied to Netty Bootstrap and Channel objects.- Parameters:
nettyHook- - netty hook object- Returns:
- config
-
setCodec
Redis data codec. Default is Kryo5Codec codec- Parameters:
codec- object- Returns:
- config
- See Also:
-
getCodec
-
isReferenceEnabled
public boolean isReferenceEnabled()Config option indicate whether Redisson Reference feature is enabled.Default value is
true- Returns:
trueif Redisson Reference feature enabled
-
setReferenceEnabled
public void setReferenceEnabled(boolean redissonReferenceEnabled) Config option for enabling Redisson Reference featureDefault value is
true- Parameters:
redissonReferenceEnabled- flag
-
useClusterServers
Init cluster servers configuration- Returns:
- config
-
getClusterServersConfig
-
setClusterServersConfig
-
useReplicatedServers
Init Replicated servers configuration. Most used with Azure Redis Cache or AWS Elasticache- Returns:
- ReplicatedServersConfig
-
getReplicatedServersConfig
-
setReplicatedServersConfig
-
useCustomServers
Deprecated.This is an extension point to supply custom connection manager.- Parameters:
connectionManager- for supply- See Also:
-
useSingleServer
Init single server configuration.- Returns:
- SingleServerConfig
-
getSingleServerConfig
-
setSingleServerConfig
-
useSentinelServers
Init sentinel servers configuration.- Returns:
- SentinelServersConfig
-
getSentinelServersConfig
-
setSentinelServersConfig
-
useMasterSlaveServers
Init master/slave servers configuration.- Returns:
- MasterSlaveServersConfig
-
getMasterSlaveServersConfig
-
setMasterSlaveServersConfig
-
isClusterConfig
public boolean isClusterConfig() -
isSentinelConfig
public boolean isSentinelConfig() -
isSingleConfig
public boolean isSingleConfig() -
getThreads
public int getThreads() -
setThreads
Threads amount shared across all listeners ofRTopicobject, invocation handlers ofRRemoteServiceobject andRExecutorServicetasks.Default is
16.0meanscurrent_processors_amount * 2- Parameters:
threads- amount- Returns:
- config
-
setTransportMode
Transport modeDefault is
TransportMode.NIO- Parameters:
transportMode- param- Returns:
- config
-
getTransportMode
-
setNettyThreads
Threads amount shared between all redis clients used by Redisson.Default is
32.0meanscurrent_processors_amount * 2- Parameters:
nettyThreads- amount- Returns:
- config
-
getNettyThreads
public int getNettyThreads() -
setExecutor
Use external ExecutorService. ExecutorService processes all listeners ofRTopic,RRemoteServiceinvocation handlers andRExecutorServicetasks.The caller is responsible for closing the ExecutorService.
- Parameters:
executor- object- Returns:
- config
-
getExecutor
-
setEventLoopGroup
Use external EventLoopGroup. EventLoopGroup processes all Netty connection tied to Redis servers. Each EventLoopGroup creates own threads and each Redisson client creates own EventLoopGroup by default. So if there are multiple Redisson instances in same JVM it would be useful to share one EventLoopGroup among them.Only
EpollEventLoopGroup,KQueueEventLoopGroupNioEventLoopGroupcan be used.The caller is responsible for closing the EventLoopGroup.
- Parameters:
eventLoopGroup- object- Returns:
- config
-
getEventLoopGroup
public io.netty.channel.EventLoopGroup getEventLoopGroup() -
setLockWatchdogTimeout
This parameter is only used if lock has been acquired without leaseTimeout parameter definition. Lock expires afterlockWatchdogTimeoutif watchdog didn't extend it to nextlockWatchdogTimeouttime 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
- Parameters:
lockWatchdogTimeout- timeout in milliseconds- Returns:
- config
-
getLockWatchdogTimeout
public long getLockWatchdogTimeout() -
setCheckLockSyncedSlaves
Defines whether to check synchronized slaves amount with actual slaves amount after lock acquisition.Default is
true.- Parameters:
checkLockSyncedSlaves-trueif check required,falseotherwise.- Returns:
- config
-
isCheckLockSyncedSlaves
public boolean isCheckLockSyncedSlaves() -
setKeepPubSubOrder
Defines whether to keep PubSub messages handling in arrival order or handle messages concurrently.This setting applied only for PubSub messages per channel.
Default is
true.- Parameters:
keepPubSubOrder- -trueif order required,falseotherwise.- Returns:
- config
-
isKeepPubSubOrder
public boolean isKeepPubSubOrder() -
setAddressResolverGroupFactory
public Config setAddressResolverGroupFactory(AddressResolverGroupFactory addressResolverGroupFactory) Used to switch betweenDnsAddressResolverGroupimplementations. Switch to round robinRoundRobinDnsAddressResolverGroupwhen you need to optimize the url resolving.- Parameters:
addressResolverGroupFactory-- Returns:
- config
-
getAddressResolverGroupFactory
-
fromJSON
Deprecated.- Throws:
IOException
-
fromJSON
Deprecated.- Throws:
IOException
-
fromJSON
Deprecated.- Throws:
IOException
-
fromJSON
Deprecated.- Throws:
IOException
-
fromJSON
Deprecated.- Throws:
IOException
-
fromJSON
Deprecated.- Throws:
IOException
-
toJSON
Deprecated.- Throws:
IOException
-
fromYAML
Read config object stored in YAML format fromString- Parameters:
content- of config- Returns:
- config
- Throws:
IOException- error
-
fromYAML
Read config object stored in YAML format fromInputStream- Parameters:
inputStream- object- Returns:
- config
- Throws:
IOException- error
-
fromYAML
Read config object stored in YAML format fromFile- Parameters:
file- object- Returns:
- config
- Throws:
IOException- error
-
fromYAML
- Throws:
IOException
-
fromYAML
Read config object stored in YAML format fromURL- Parameters:
url- object- Returns:
- config
- Throws:
IOException- error
-
fromYAML
Read config object stored in YAML format fromReader- Parameters:
reader- object- Returns:
- config
- Throws:
IOException- error
-
toYAML
Convert current configuration to YAML format- Returns:
- config in yaml format
- Throws:
IOException- error
-
setUseScriptCache
Defines whether to use Lua-script cache on Redis side. Most Redisson methods are Lua-script based and this setting turned on could increase speed of such methods execution and save network traffic.Default is
false.- Parameters:
useScriptCache- -trueif Lua-script caching is required,falseotherwise.- Returns:
- config
-
isUseScriptCache
public boolean isUseScriptCache() -
getMinCleanUpDelay
public int getMinCleanUpDelay() -
setMinCleanUpDelay
Defines minimum delay in seconds for clean up process of expired entries.Applied to JCache, RSetCache, RMapCache, RListMultimapCache, RSetMultimapCache objects.
Default is
5.- Parameters:
minCleanUpDelay- - delay in seconds- Returns:
- config
-
getMaxCleanUpDelay
public int getMaxCleanUpDelay() -
setMaxCleanUpDelay
Defines maximum delay in seconds for clean up process of expired entries.Applied to JCache, RSetCache, RMapCache, RListMultimapCache, RSetMultimapCache objects.
Default is
1800.- Parameters:
maxCleanUpDelay- - delay in seconds- Returns:
- config
-
getCleanUpKeysAmount
public int getCleanUpKeysAmount() -
setCleanUpKeysAmount
Defines expired keys amount deleted per single operation during clean up process of expired entries.Applied to JCache, RSetCache, RMapCache, RListMultimapCache, RSetMultimapCache objects.
Default is
100.- Parameters:
cleanUpKeysAmount- - delay in seconds- Returns:
- config
-
isUseThreadClassLoader
public boolean isUseThreadClassLoader() -
setUseThreadClassLoader
Defines whether to supply Thread ContextClassLoader to Codec. Usage of Thread.getContextClassLoader() may resolve ClassNotFoundException error. For example, this error arise if Redisson is used in both Tomcat and deployed application.Default is
true.- Parameters:
useThreadClassLoader-trueif Thread ContextClassLoader is used,falseotherwise.- Returns:
- config
-
getReliableTopicWatchdogTimeout
public long getReliableTopicWatchdogTimeout() -
setReliableTopicWatchdogTimeout
Reliable Topic subscriber expires aftertimeoutif watchdog didn't extend it to nexttimeouttime interval.This prevents against infinity grow of stored messages in topic due to Redisson client crush or any other reason when subscriber can't consumer messages anymore.
Default is 600000 milliseconds
- Parameters:
timeout- timeout in milliseconds- Returns:
- config
-
getConnectionListener
-
setConnectionListener
Sets connection listener which is triggered when Redisson connected/disconnected to Redis server- Parameters:
connectionListener- - connection listener- Returns:
- config
-
getSlavesSyncTimeout
public long getSlavesSyncTimeout() -
setSlavesSyncTimeout
Defines slaves synchronization timeout applied to each operation ofRLock,RSemaphore,RPermitExpirableSemaphoreobjects.Default is
1000milliseconds.- Parameters:
timeout- timeout in milliseconds- Returns:
- config
-
isLazyInitialization
public boolean isLazyInitialization() -
setLazyInitialization
Defines whether Redisson connects to Redis only when first Redis call is made and not during Redisson instance creation.Default value is
false- Parameters:
lazyInitialization-trueconnects to Redis only when first Redis call is made,falseconnects to Redis during Redisson instance creation.- Returns:
-