ConnectionPool.ConnectionFuture (Apache Tomcat 9.0.120 API Documentation)
Description: declaration: package: org.apache.tomcat.jdbc.pool, class: ConnectionPool, class: ConnectionFuture

# Class ConnectionPool.ConnectionFuture

java.lang.Object
org.apache.tomcat.jdbc.pool.ConnectionPool.ConnectionFuture

All Implemented Interfaces:
  `Runnable, Future<Connection>`

Enclosing class:
  `ConnectionPool`

protected class ConnectionPool.ConnectionFuture extends Object implements Future<Connection>, Runnable
Thread safe wrapper around a future for the regular queue This one retrieves the pooled connection object and performs the initialization according to interceptors and validation rules. This class is thread safe and is cancellable

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from interface Future

  `Future.State`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ConnectionFuture(Future<PooledConnection> pcf)`
  Creates a ConnectionFuture backed by an async pooled connection future.
  `ConnectionFuture(PooledConnection pc)`
  Creates a ConnectionFuture backed by an already available pooled connection.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `cancel(boolean mayInterruptIfRunning)`
  `Connection`
  `get()`
  `Connection`
  `get(long timeout, TimeUnit unit)`
  `boolean`
  `isCancelled()`
  `boolean`
  `isDone()`
  `void`
  `run()`
  run method to be executed when cancelled by an executor

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface Future

  `exceptionNow, resultNow, state`

- ## Constructor Details

  - ### ConnectionFuture

    public ConnectionFuture(Future<PooledConnection> pcf)
    Creates a ConnectionFuture backed by an async pooled connection future.
    Parameters:
      `pcf` - the future for the pooled connection

  - ### ConnectionFuture

    public ConnectionFuture(PooledConnection pc) throws SQLException
    Creates a ConnectionFuture backed by an already available pooled connection.
    Parameters:
      `pc` - the pooled connection
    Throws:
      `SQLException` - if connection setup fails

- ## Method Details

  - ### cancel

    public boolean cancel(boolean mayInterruptIfRunning)
    Specified by:
      `cancel` in interface `Future<Connection>`

  - ### get

    public Connection get() throws InterruptedException, ExecutionException
    Specified by:
      `get` in interface `Future<Connection>`
    Throws:
      `InterruptedException`
      `ExecutionException`

  - ### get

    public Connection get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
    Specified by:
      `get` in interface `Future<Connection>`
    Throws:
      `InterruptedException`
      `ExecutionException`
      `TimeoutException`

  - ### isCancelled

    public boolean isCancelled()
    Specified by:
      `isCancelled` in interface `Future<Connection>`

  - ### isDone

    public boolean isDone()
    Specified by:
      `isDone` in interface `Future<Connection>`

  - ### run

    public void run()
    run method to be executed when cancelled by an executor
    Specified by:
      `run` in interface `Runnable`