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 StringgetClientName()intgetConnectTimeout()intgetIdleConnectionTimeout()NameMappergetNameMapper()StringgetPassword()intgetPingConnectionInterval()intgetRetryAttempts()intgetRetryInterval()URLgetSslKeystore()StringgetSslKeystorePassword()String[]getSslProtocols()SslProvidergetSslProvider()URLgetSslTruststore()StringgetSslTruststorePassword()intgetSubscriptionsPerConnection()intgetTimeout()StringgetUsername()booleanisKeepAlive()booleanisSslEnableEndpointIdentification()booleanisTcpNoDelay()TsetClientName(String clientName)Setup connection name during connection init via CLIENT SETNAME commandTsetConnectTimeout(int connectTimeout)Timeout during connecting to any Redis server.TsetIdleConnectionTimeout(int idleConnectionTimeout)If pooled connection not used for atimeouttime and current connections amount bigger than minimum idle connections pool size, then it will closed and removed from pool.TsetKeepAlive(boolean keepAlive)Enables TCP keepAlive for connectionTsetNameMapper(NameMapper nameMapper)Defines Name mapper which maps Redisson object name.TsetPassword(String password)Password for Redis authentication.TsetPingConnectionInterval(int pingConnectionInterval)Defines PING command sending interval per connection to Redis.TsetRetryAttempts(int retryAttempts)Error will be thrown if Redis command can't be sent to Redis server afterretryAttempts.TsetRetryInterval(int retryInterval)Defines time interval for another one attempt send Redis command if it hasn't been sent already.TsetSslEnableEndpointIdentification(boolean sslEnableEndpointIdentification)Enables SSL endpoint identification.TsetSslKeystore(URL sslKeystore)Defines path to SSL keystoreTsetSslKeystorePassword(String sslKeystorePassword)Defines password for SSL keystoreTsetSslProtocols(String[] sslProtocols)Defines SSL protocols.TsetSslProvider(SslProvider sslProvider)Defines SSL provider used to handle SSL connections.TsetSslTruststore(URL sslTruststore)Defines path to SSL truststoreTsetSslTruststorePassword(String sslTruststorePassword)Defines password for SSL truststoreTsetSubscriptionsPerConnection(int subscriptionsPerConnection)Subscriptions per Redis connection limitTsetTcpNoDelay(boolean tcpNoDelay)Enables TCP noDelay for connectionTsetTimeout(int timeout)Redis server response timeout.TsetUsername(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
nullRequires 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 thentimeoutwill be started.Default is
3attempts- 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
1500milliseconds- 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
3000milliseconds- 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
10000milliseconds.- Parameters:
connectTimeout- - timeout in milliseconds- Returns:
- config
-
getConnectTimeout
public int getConnectTimeout()
-
setIdleConnectionTimeout
public T setIdleConnectionTimeout(int idleConnectionTimeout)
If pooled connection not used for atimeouttime and current connections amount bigger than minimum idle connections pool size, then it will closed and removed from pool.Default is
10000milliseconds.- 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.0means 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
-
-