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 Details

    • setSubscriptionsPerConnection

      public T setSubscriptionsPerConnection(int subscriptionsPerConnection)
      Subscriptions per Redis connection limit

      Default 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 needed

      Default 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 after retryAttempts. But if it sent successfully then timeout 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()
    • getSubscriptionTimeout

      public int getSubscriptionTimeout()
    • setSubscriptionTimeout

      public T setSubscriptionTimeout(int subscriptionTimeout)
      Defines subscription timeout applied per channel subscription.

      Default is 7500 milliseconds.

      Parameters:
      subscriptionTimeout - timeout in milliseconds
      Returns:
      config
    • setClientName

      public T setClientName(String clientName)
      Setup connection name during connection init via CLIENT SETNAME command

      Default 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 a timeout 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 truststore

      Default is null

      Parameters:
      sslTruststore - truststore path
      Returns:
      config
    • getSslTruststorePassword

      public String getSslTruststorePassword()
    • setSslTruststorePassword

      public T setSslTruststorePassword(String sslTruststorePassword)
      Defines password for SSL truststore. SSL truststore is read on each new connection creation and can be dynamically reloaded.

      Default is null

      Parameters:
      sslTruststorePassword - - password
      Returns:
      config
    • getSslKeystore

      public URL getSslKeystore()
    • setSslKeystore

      public T setSslKeystore(URL sslKeystore)
      Defines path to SSL keystore. SSL keystore is read on each new connection creation and can be dynamically reloaded.

      Default is null

      Parameters:
      sslKeystore - path to keystore
      Returns:
      config
    • getSslKeystorePassword

      public String getSslKeystorePassword()
    • setSslKeystorePassword

      public T setSslKeystorePassword(String sslKeystorePassword)
      Defines password for SSL keystore

      Default 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, TLSv1

      Default 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 connection

      Default is false

      Parameters:
      keepAlive - boolean value
      Returns:
      config
    • getTcpKeepAliveCount

      public int getTcpKeepAliveCount()
    • setTcpKeepAliveCount

      public T setTcpKeepAliveCount(int tcpKeepAliveCount)
      Defines the maximum number of keepalive probes TCP should send before dropping the connection.
      Parameters:
      tcpKeepAliveCount - maximum number of keepalive probes
      Returns:
      config
    • getTcpKeepAliveIdle

      public int getTcpKeepAliveIdle()
    • setTcpKeepAliveIdle

      public T setTcpKeepAliveIdle(int tcpKeepAliveIdle)
      Defines the time in seconds the connection needs to remain idle before TCP starts sending keepalive probes,
      Parameters:
      tcpKeepAliveIdle - time in seconds
      Returns:
      config
    • getTcpKeepAliveInterval

      public int getTcpKeepAliveInterval()
    • setTcpKeepAliveInterval

      public T setTcpKeepAliveInterval(int tcpKeepAliveInterval)
      Defines the time in seconds between individual keepalive probes.
      Parameters:
      tcpKeepAliveInterval - time in seconds
      Returns:
      config
    • getTcpUserTimeout

      public int getTcpUserTimeout()
    • setTcpUserTimeout

      public T setTcpUserTimeout(int tcpUserTimeout)
      Defines the maximum amount of time in milliseconds that transmitted data may remain unacknowledged, or buffered data may remain untransmitted (due to zero window size) before TCP will forcibly close the connection.
      Parameters:
      tcpUserTimeout - time in milliseconds
      Returns:
      config
    • isTcpNoDelay

      public boolean isTcpNoDelay()
    • setTcpNoDelay

      public T setTcpNoDelay(boolean tcpNoDelay)
      Enables TCP noDelay for connection

      Default 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
    • getCredentialsResolver

      public CredentialsResolver getCredentialsResolver()
    • setCredentialsResolver

      public T setCredentialsResolver(CredentialsResolver credentialsResolver)
      Defines Credentials resolver which is invoked during connection for Redis server authentication. It makes possible to specify dynamically changing Redis credentials.
      Parameters:
      credentialsResolver - Credentials resolver object
      Returns:
      config
    • getSslCiphers

      public String[] getSslCiphers()
    • setSslCiphers

      public BaseConfig<T> setSslCiphers(String[] sslCiphers)
      Defines SSL ciphers.

      Default is null

      Parameters:
      sslCiphers - ciphers
      Returns:
      config
    • getSslTrustManagerFactory

      public TrustManagerFactory getSslTrustManagerFactory()
    • setSslTrustManagerFactory

      public BaseConfig<T> setSslTrustManagerFactory(TrustManagerFactory trustManagerFactory)
      Defines SSL TrustManagerFactory.

      Default is null

      Parameters:
      trustManagerFactory - trust manager value
      Returns:
      config
    • getSslKeyManagerFactory

      public KeyManagerFactory getSslKeyManagerFactory()
    • setSslKeyManagerFactory

      public BaseConfig<T> setSslKeyManagerFactory(KeyManagerFactory keyManagerFactory)
      Defines SSL KeyManagerFactory.

      Default is null

      Parameters:
      keyManagerFactory - key manager value
      Returns:
      config
    • getCommandMapper

      public CommandMapper getCommandMapper()
    • setCommandMapper

      public BaseConfig<T> setCommandMapper(CommandMapper commandMapper)
      Defines Command mapper which maps Redis command name. Applied to all Redis commands.
      Parameters:
      commandMapper - Redis command name mapper object
      Returns:
      config