Class ConnectionPool.ConnectionFuture

  • All Implemented Interfaces:
    java.lang.Runnable, java.util.concurrent.Future<java.sql.Connection>
    Enclosing class:
    ConnectionPool

    protected class ConnectionPool.ConnectionFuture
    extends java.lang.Object
    implements java.util.concurrent.Future<java.sql.Connection>, java.lang.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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean cancel​(boolean mayInterruptIfRunning)
      java.sql.Connection get()
      java.sql.Connection get​(long timeout, java.util.concurrent.TimeUnit unit)
      boolean isCancelled()
      boolean isDone()
      void run()
      run method to be executed when cancelled by an executor
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConnectionFuture

        public ConnectionFuture​(java.util.concurrent.Future<PooledConnection> pcf)
      • ConnectionFuture

        public ConnectionFuture​(PooledConnection pc)
                         throws java.sql.SQLException
        Throws:
        java.sql.SQLException
    • Method Detail

      • cancel

        public boolean cancel​(boolean mayInterruptIfRunning)
        Specified by:
        cancel in interface java.util.concurrent.Future<java.sql.Connection>
      • get

        public java.sql.Connection get()
                                throws java.lang.InterruptedException,
                                       java.util.concurrent.ExecutionException
        Specified by:
        get in interface java.util.concurrent.Future<java.sql.Connection>
        Throws:
        java.lang.InterruptedException
        java.util.concurrent.ExecutionException
      • get

        public java.sql.Connection get​(long timeout,
                                       java.util.concurrent.TimeUnit unit)
                                throws java.lang.InterruptedException,
                                       java.util.concurrent.ExecutionException,
                                       java.util.concurrent.TimeoutException
        Specified by:
        get in interface java.util.concurrent.Future<java.sql.Connection>
        Throws:
        java.lang.InterruptedException
        java.util.concurrent.ExecutionException
        java.util.concurrent.TimeoutException
      • isCancelled

        public boolean isCancelled()
        Specified by:
        isCancelled in interface java.util.concurrent.Future<java.sql.Connection>
      • isDone

        public boolean isDone()
        Specified by:
        isDone in interface java.util.concurrent.Future<java.sql.Connection>
      • run

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