Package org.apache.tomcat.jdbc.pool
Class ConnectionPool.ConnectionFuture
- java.lang.Object
-
- org.apache.tomcat.jdbc.pool.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
-
-
Constructor Summary
Constructors Constructor Description ConnectionFuture(java.util.concurrent.Future<PooledConnection> pcf)
ConnectionFuture(PooledConnection pc)
-
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
-
-
-
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 interfacejava.util.concurrent.Future<java.sql.Connection>
-
get
public java.sql.Connection get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
- Specified by:
get
in interfacejava.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 interfacejava.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 interfacejava.util.concurrent.Future<java.sql.Connection>
-
isDone
public boolean isDone()
- Specified by:
isDone
in interfacejava.util.concurrent.Future<java.sql.Connection>
-
run
public void run()
run method to be executed when cancelled by an executor- Specified by:
run
in interfacejava.lang.Runnable
-
-