Package org.redisson.config
Class BaseConfig<T extends BaseConfig<T>>
- java.lang.Object
-
- org.redisson.config.BaseConfig<T>
-
- Type Parameters:
T
- config type
- Direct Known Subclasses:
BaseMasterSlaveServersConfig
,SingleServerConfig
public class BaseConfig<T extends BaseConfig<T>> extends Object
- Author:
- Nikita Koksharov
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getClientName()
int
getConnectTimeout()
int
getIdleConnectionTimeout()
NameMapper
getNameMapper()
String
getPassword()
int
getPingConnectionInterval()
int
getRetryAttempts()
int
getRetryInterval()
URL
getSslKeystore()
String
getSslKeystorePassword()
String[]
getSslProtocols()
SslProvider
getSslProvider()
URL
getSslTruststore()
String
getSslTruststorePassword()
int
getSubscriptionsPerConnection()
int
getTimeout()
String
getUsername()
boolean
isKeepAlive()
boolean
isSslEnableEndpointIdentification()
boolean
isTcpNoDelay()
T
setClientName(String clientName)
Setup connection name during connection init via CLIENT SETNAME commandT
setConnectTimeout(int connectTimeout)
Timeout during connecting to any Redis server.T
setIdleConnectionTimeout(int idleConnectionTimeout)
If pooled connection not used for atimeout
time and current connections amount bigger than minimum idle connections pool size, then it will closed and removed from pool.T
setKeepAlive(boolean keepAlive)
Enables TCP keepAlive for connectionT
setNameMapper(NameMapper nameMapper)
Defines Name mapper which maps Redisson object name.T
setPassword(String password)
Password for Redis authentication.T
setPingConnectionInterval(int pingConnectionInterval)
Defines PING command sending interval per connection to Redis.T
setRetryAttempts(int retryAttempts)
Error will be thrown if Redis command can't be sent to Redis server afterretryAttempts
.T
setRetryInterval(int retryInterval)
Defines time interval for another one attempt send Redis command if it hasn't been sent already.T
setSslEnableEndpointIdentification(boolean sslEnableEndpointIdentification)
Enables SSL endpoint identification.T
setSslKeystore(URL sslKeystore)
Defines path to SSL keystoreT
setSslKeystorePassword(String sslKeystorePassword)
Defines password for SSL keystoreT
setSslProtocols(String[] sslProtocols)
Defines SSL protocols.T
setSslProvider(SslProvider sslProvider)
Defines SSL provider used to handle SSL connections.T
setSslTruststore(URL sslTruststore)
Defines path to SSL truststoreT
setSslTruststorePassword(String sslTruststorePassword)
Defines password for SSL truststoreT
setSubscriptionsPerConnection(int subscriptionsPerConnection)
Subscriptions per Redis connection limitT
setTcpNoDelay(boolean tcpNoDelay)
Enables TCP noDelay for connectionT
setTimeout(int timeout)
Redis server response timeout.T
setUsername(String username)
Username for Redis authentication.
-
-
-
Method Detail
-
setSubscriptionsPerConnection
public T setSubscriptionsPerConnection(int subscriptionsPerConnection)
Subscriptions per Redis connection limitDefault is
5
- Parameters:
subscriptionsPerConnection
- amount- Returns:
- config
-
getSubscriptionsPerConnection
public int getSubscriptionsPerConnection()
-
setPassword
public T setPassword(String password)
Password for Redis authentication. Should be null if not needed.Default is
null
- Parameters:
password
- for connection- Returns:
- config
-
getPassword
public String getPassword()
-
setUsername
public T setUsername(String username)
Username for Redis authentication. Should be null if not neededDefault is
null
Requires Redis 6.0+
- Parameters:
username
- for connection- Returns:
- config
-
getUsername
public String getUsername()
-
setRetryAttempts
public T setRetryAttempts(int retryAttempts)
Error will be thrown if Redis command can't be sent to Redis server afterretryAttempts
. But if it sent successfully thentimeout
will be started.Default is
3
attempts- Parameters:
retryAttempts
- - retry attempts- Returns:
- config
- See Also:
timeout
-
getRetryAttempts
public int getRetryAttempts()
-
setRetryInterval
public T setRetryInterval(int retryInterval)
Defines time interval for another one attempt send Redis command if it hasn't been sent already.Default is
1500
milliseconds- Parameters:
retryInterval
- - time in milliseconds- Returns:
- config
-
getRetryInterval
public int getRetryInterval()
-
setTimeout
public T setTimeout(int timeout)
Redis server response timeout. Starts to countdown when Redis command has been successfully sent.Default is
3000
milliseconds- Parameters:
timeout
- in milliseconds- Returns:
- config
-
getTimeout
public int getTimeout()
-
setClientName
public T setClientName(String clientName)
Setup connection name during connection init via CLIENT SETNAME commandDefault is
null
- Parameters:
clientName
- - name of client- Returns:
- config
-
getClientName
public String getClientName()
-
setConnectTimeout
public T setConnectTimeout(int connectTimeout)
Timeout during connecting to any Redis server.Default is
10000
milliseconds.- Parameters:
connectTimeout
- - timeout in milliseconds- Returns:
- config
-
getConnectTimeout
public int getConnectTimeout()
-
setIdleConnectionTimeout
public T setIdleConnectionTimeout(int idleConnectionTimeout)
If pooled connection not used for atimeout
time and current connections amount bigger than minimum idle connections pool size, then it will closed and removed from pool.Default is
10000
milliseconds.- Parameters:
idleConnectionTimeout
- - timeout in milliseconds- Returns:
- config
-
getIdleConnectionTimeout
public int getIdleConnectionTimeout()
-
isSslEnableEndpointIdentification
public boolean isSslEnableEndpointIdentification()
-
setSslEnableEndpointIdentification
public T setSslEnableEndpointIdentification(boolean sslEnableEndpointIdentification)
Enables SSL endpoint identification.Default is
true
- Parameters:
sslEnableEndpointIdentification
- - boolean value- Returns:
- config
-
getSslProvider
public SslProvider getSslProvider()
-
setSslProvider
public T setSslProvider(SslProvider sslProvider)
Defines SSL provider used to handle SSL connections.Default is
JDK
- Parameters:
sslProvider
- - ssl provider- Returns:
- config
-
getSslTruststore
public URL getSslTruststore()
-
setSslTruststore
public T setSslTruststore(URL sslTruststore)
Defines path to SSL truststoreDefault is
null
- Parameters:
sslTruststore
- - path- Returns:
- config
-
getSslTruststorePassword
public String getSslTruststorePassword()
-
setSslTruststorePassword
public T setSslTruststorePassword(String sslTruststorePassword)
Defines password for SSL truststoreDefault is
null
- Parameters:
sslTruststorePassword
- - password- Returns:
- config
-
getSslKeystore
public URL getSslKeystore()
-
setSslKeystore
public T setSslKeystore(URL sslKeystore)
Defines path to SSL keystoreDefault is
null
- Parameters:
sslKeystore
- - path to keystore- Returns:
- config
-
getSslKeystorePassword
public String getSslKeystorePassword()
-
setSslKeystorePassword
public T setSslKeystorePassword(String sslKeystorePassword)
Defines password for SSL keystoreDefault is
null
- Parameters:
sslKeystorePassword
- - password- Returns:
- config
-
getSslProtocols
public String[] getSslProtocols()
-
setSslProtocols
public T setSslProtocols(String[] sslProtocols)
Defines SSL protocols. Example values: TLSv1.3, TLSv1.2, TLSv1.1, TLSv1Default is
null
- Parameters:
sslProtocols
- - protocols- Returns:
- config
-
getPingConnectionInterval
public int getPingConnectionInterval()
-
setPingConnectionInterval
public T setPingConnectionInterval(int pingConnectionInterval)
Defines PING command sending interval per connection to Redis.0
means disable.Default is
30000
- Parameters:
pingConnectionInterval
- - time in milliseconds- Returns:
- config
-
isKeepAlive
public boolean isKeepAlive()
-
setKeepAlive
public T setKeepAlive(boolean keepAlive)
Enables TCP keepAlive for connectionDefault is
false
- Parameters:
keepAlive
- - boolean value- Returns:
- config
-
isTcpNoDelay
public boolean isTcpNoDelay()
-
setTcpNoDelay
public T setTcpNoDelay(boolean tcpNoDelay)
Enables TCP noDelay for connectionDefault is
true
- Parameters:
tcpNoDelay
- - boolean value- Returns:
- config
-
getNameMapper
public NameMapper getNameMapper()
-
setNameMapper
public T setNameMapper(NameMapper nameMapper)
Defines Name mapper which maps Redisson object name. Applied to all Redisson objects.- Parameters:
nameMapper
- - name mapper object- Returns:
- config
-
-