Package org.apache.tomcat.jdbc.pool
Class FairBlockingQueue.ItemFuture<T>
- java.lang.Object
-
- org.apache.tomcat.jdbc.pool.FairBlockingQueue.ItemFuture<T>
-
- Type Parameters:
T- the type of the item
- All Implemented Interfaces:
java.util.concurrent.Future<T>
- Enclosing class:
- FairBlockingQueue<E>
protected class FairBlockingQueue.ItemFuture<T> extends java.lang.Object implements java.util.concurrent.Future<T>A non-cancellable future used to check if a connection has been made available.
-
-
Constructor Summary
Constructors Constructor Description ItemFuture(FairBlockingQueue.ExchangeCountDownLatch<T> latch)Creates an ItemFuture that waits on the given latch.ItemFuture(T item)Creates an ItemFuture with the given item already available.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancancel(boolean mayInterruptIfRunning)Tget()Tget(long timeout, java.util.concurrent.TimeUnit unit)booleanisCancelled()booleanisDone()
-
-
-
Field Detail
-
item
protected volatile T item
The item directly available in the future.
-
latch
protected volatile FairBlockingQueue.ExchangeCountDownLatch<T> latch
The latch used to wait for an item.
-
canceled
protected volatile boolean canceled
Whether this future has been cancelled.
-
-
Constructor Detail
-
ItemFuture
public ItemFuture(T item)
Creates an ItemFuture with the given item already available.- Parameters:
item- the item
-
ItemFuture
public ItemFuture(FairBlockingQueue.ExchangeCountDownLatch<T> latch)
Creates an ItemFuture that waits on the given latch.- Parameters:
latch- the latch to wait on
-
-
Method Detail
-
cancel
public boolean cancel(boolean mayInterruptIfRunning)
- Specified by:
cancelin interfacejava.util.concurrent.Future<T>
-
get
public T get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
- Specified by:
getin interfacejava.util.concurrent.Future<T>- Throws:
java.lang.InterruptedExceptionjava.util.concurrent.ExecutionException
-
get
public T get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
- Specified by:
getin interfacejava.util.concurrent.Future<T>- Throws:
java.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionjava.util.concurrent.TimeoutException
-
isCancelled
public boolean isCancelled()
- Specified by:
isCancelledin interfacejava.util.concurrent.Future<T>
-
isDone
public boolean isDone()
- Specified by:
isDonein interfacejava.util.concurrent.Future<T>
-
-