Class PoolOptions


  • public class PoolOptions
    extends Object
    • Constructor Detail

      • PoolOptions

        public PoolOptions()
      • PoolOptions

        public PoolOptions​(PoolOptions other)
      • PoolOptions

        public PoolOptions​(JsonObject json)
    • Method Detail

      • 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 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.

        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 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.

        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
      • toJson

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