Class PoolExhaustedException

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Iterable<java.lang.Throwable>

    public class PoolExhaustedException
    extends java.sql.SQLException
    Exception thrown when the connection pool is exhausted and no connections are available. The caller of a synchronous borrow that is refused - one whose wait on the empty pool timed out - receives it directly. On the asynchronous path of ConnectionPool.getConnectionAsync() the same exhaustion is absorbed into a wait instead and never surfaces as this exception: an exhausted pool surfaces there through the Future as a TimeoutException for a timed wait, a CancellationException when the pool closes under the waiter, or an ExecutionException carrying the underlying failure when the wait could not be completed.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String SQL_STATE
      SQL state reported with pool-exhaustion failures: "HY000", the general error class.
    • Constructor Summary

      Constructors 
      Constructor Description
      PoolExhaustedException()
      Constructs a PoolExhaustedException with no detail message.
      PoolExhaustedException​(java.lang.String reason)
      Constructs a PoolExhaustedException with the specified detail message.
      PoolExhaustedException​(java.lang.String reason, java.lang.String sqlState)
      Constructs a PoolExhaustedException with the specified detail message and SQL state.
      PoolExhaustedException​(java.lang.String reason, java.lang.String sqlState, int vendorCode)
      Constructs a PoolExhaustedException with the specified detail message, SQL state, and vendor code.
      PoolExhaustedException​(java.lang.String reason, java.lang.String sqlState, int vendorCode, java.lang.Throwable cause)
      Constructs a PoolExhaustedException with the specified detail message, SQL state, vendor code, and cause.
      PoolExhaustedException​(java.lang.String reason, java.lang.String sqlState, java.lang.Throwable cause)
      Constructs a PoolExhaustedException with the specified detail message, SQL state, and cause.
      PoolExhaustedException​(java.lang.String reason, java.lang.Throwable cause)
      Constructs a PoolExhaustedException with the specified detail message and cause.
      PoolExhaustedException​(java.lang.Throwable cause)
      Constructs a PoolExhaustedException with the specified cause.
    • Method Summary

      • Methods inherited from class java.sql.SQLException

        getErrorCode, getNextException, getSQLState, iterator, setNextException
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Field Detail

      • SQL_STATE

        public static final java.lang.String SQL_STATE
        SQL state reported with pool-exhaustion failures: "HY000", the general error class. Pool exhaustion is a pool-side condition rather than a database error, so none of the connection-class states (the 08xxx family, which describe the session itself failing) says exactly this; still, consumers that multiplex many SQLException sources and classify them by state need a non-null label to sort on. HY000 is shared with unrelated driver-reported general errors, so a state-based classifier should treat the state as a pointer and corroborate it with instanceof PoolExhaustedException rather than treat it as exclusive to pool exhaustion. The state is stamped by the message-only constructor the pool throws through; the constructors that mirror the SQLException signatures without a state parameter (no-arg and cause-only) carry none, as those super-signatures take none, and an explicitly given state always wins.
        See Also:
        Constant Field Values
    • Constructor Detail

      • PoolExhaustedException

        public PoolExhaustedException()
        Constructs a PoolExhaustedException with no detail message.
      • PoolExhaustedException

        public PoolExhaustedException​(java.lang.String reason)
        Constructs a PoolExhaustedException with the specified detail message. The exception carries SQL_STATE as its SQL state.
        Parameters:
        reason - the detail message
      • PoolExhaustedException

        public PoolExhaustedException​(java.lang.Throwable cause)
        Constructs a PoolExhaustedException with the specified cause.
        Parameters:
        cause - the cause of this exception
      • PoolExhaustedException

        public PoolExhaustedException​(java.lang.String reason,
                                      java.lang.String sqlState)
        Constructs a PoolExhaustedException with the specified detail message and SQL state.
        Parameters:
        reason - the detail message
        sqlState - the SQL state code
      • PoolExhaustedException

        public PoolExhaustedException​(java.lang.String reason,
                                      java.lang.Throwable cause)
        Constructs a PoolExhaustedException with the specified detail message and cause.
        Parameters:
        reason - the detail message
        cause - the cause of this exception
      • PoolExhaustedException

        public PoolExhaustedException​(java.lang.String reason,
                                      java.lang.String sqlState,
                                      int vendorCode)
        Constructs a PoolExhaustedException with the specified detail message, SQL state, and vendor code.
        Parameters:
        reason - the detail message
        sqlState - the SQL state code
        vendorCode - the vendor-specific error code
      • PoolExhaustedException

        public PoolExhaustedException​(java.lang.String reason,
                                      java.lang.String sqlState,
                                      java.lang.Throwable cause)
        Constructs a PoolExhaustedException with the specified detail message, SQL state, and cause.
        Parameters:
        reason - the detail message
        sqlState - the SQL state code
        cause - the cause of this exception
      • PoolExhaustedException

        public PoolExhaustedException​(java.lang.String reason,
                                      java.lang.String sqlState,
                                      int vendorCode,
                                      java.lang.Throwable cause)
        Constructs a PoolExhaustedException with the specified detail message, SQL state, vendor code, and cause.
        Parameters:
        reason - the detail message
        sqlState - the SQL state code
        vendorCode - the vendor-specific error code
        cause - the cause of this exception