Class PoolOptions

java.lang.Object
io.vertx.redis.client.PoolOptions

public class PoolOptions extends Object
  • Constructor Details

    • PoolOptions

      public PoolOptions()
    • PoolOptions

      public PoolOptions(PoolOptions other)
    • PoolOptions

      public PoolOptions(JsonObject json)
  • Method Details

    • getName

      public String getName()
      Get the connection pool name to be used for metrics reporting. The default name is a random UUID.
      Returns:
      the pool name
    • setName

      public PoolOptions setName(String name)
      Set the connection pool name to be used for metrics reporting. The default name is a random UUID.
      Parameters:
      name - the pool name
      Returns:
      fluent self
    • getCleanerInterval

      public int getCleanerInterval()
      Get how often the connection pool will be cleaned. Cleaning the connection pool means scanning for unused, too old and invalid connections and if any are found, they are forcibly closed and evicted from the pool.

      A connection is marked invalid if it enters a exception or fatal state. It is marked unused if it is unused for longer than the recycle timeout. It is marked too old if it exists longer than the maximum lifetime.

      The return value is in milliseconds. By default, the cleaning interval is 30 seconds. The value of -1 means connection pool cleaning is disabled.

      Returns:
      the cleaning interval in milliseconds, or -1 for never
    • setCleanerInterval

      public PoolOptions setCleanerInterval(int cleanerInterval)
      Set how often the connection pool will be cleaned. Cleaning the connection pool means scanning for unused, too old and invalid connections and if any are found, they are forcibly closed and evicted from the pool.

      A connection is marked invalid if it enters a exception or fatal state. It is marked unused if it is unused for longer than the recycle timeout. It is marked too old if it exists longer than the maximum lifetime.

      The value is in milliseconds. By default, the cleaning interval is 30 seconds. The value of -1 means connection pool cleaning is disabled.

      Parameters:
      cleanerInterval - the cleaning interval in milliseconds, or -1 for never
      Returns:
      fluent self
    • getMaxSize

      public int getMaxSize()
      Get the maximum size of the connection pool.

      By default, the maximum pool size is 6.

      Returns:
      the maximum pool size
    • setMaxSize

      public PoolOptions setMaxSize(int maxSize)
      Set the maximum size of the connection pool.

      By default, the maximum pool size is 6.

      When working with cluster or sentinel, this value should be at least the total number of cluster member (or number of sentinels + 1).

      Parameters:
      maxSize - the maximum pool size
      Returns:
      fluent self
    • getMaxWaiting

      public int getMaxWaiting()
      Get the maximum number of requests waiting for a connection from the pool.

      By default, the maximum number of waiting requests size is 24.

      Returns:
      the maximum number of waiting requests
    • setMaxWaiting

      public PoolOptions setMaxWaiting(int maxWaiting)
      Set the maximum number of requests waiting for a connection from the pool.

      By default, the maximum number of waiting requests size is 24.

      Parameters:
      maxWaiting - the maximum number of waiting requests
      Returns:
      fluent self
    • getRecycleTimeout

      public int getRecycleTimeout()
      Get how long a connection can stay unused before it is recycled during connection pool cleaning.

      The value is in milliseconds. By default, the recycle timeout is 3 minutes. The value of -1 means connection recycling is disabled.

      Returns:
      the recycle timeout
    • setRecycleTimeout

      public PoolOptions setRecycleTimeout(int recycleTimeout)
      Set how long a connection can stay unused before it is recycled during connection pool cleaning.

      The value is in milliseconds. By default, the recycle timeout is 3 minutes. The value of -1 means connection recycling is disabled.

      Parameters:
      recycleTimeout - the recycle timeout
      Returns:
      fluent self
    • getMaxLifetime

      public long getMaxLifetime()
      Get how long a connection can exist before it is recycled during connection pool cleaning.

      The value is in milliseconds. By default, the maximum lifetime is -1. The value of -1 means connections are never too old.

      As opposed to recycle timeout, this property does not take into account when the connection was last used. If the connection is too old, it is evicted even if it was used very recently.

      Returns:
      the maximum lifetime
    • setMaxLifetime

      public PoolOptions setMaxLifetime(long maxLifetime)
      Set how long a connection can exist before it is recycled during connection pool cleaning.

      The value is in milliseconds. By default, the maximum lifetime is -1. The value of -1 means connections are never too old.

      As opposed to recycle timeout, this property does not take into account when the connection was last used. If the connection is too old, it is evicted even if it was used very recently.

      Parameters:
      maxLifetime - the maximum lifetime
      Returns:
      fluent self
    • toJson

      public JsonObject toJson()
      Converts this object to JSON notation.
      Returns:
      JSON