Package org.apache.tomcat.jdbc.pool
Class FairBlockingQueue.ExchangeCountDownLatch<T>
- java.lang.Object
-
- java.util.concurrent.CountDownLatch
-
- org.apache.tomcat.jdbc.pool.FairBlockingQueue.ExchangeCountDownLatch<T>
-
- Type Parameters:
T- the type of the item to exchange
- Enclosing class:
- FairBlockingQueue<E>
protected class FairBlockingQueue.ExchangeCountDownLatch<T> extends java.util.concurrent.CountDownLatchA count down latch that can be used to exchange information.
-
-
Field Summary
Fields Modifier and Type Field Description protected FairBlockingQueue.ItemFuture<T>futureThe future the item is exchanged with, set byFairBlockingQueue.pollAsync()and null for the waiters ofFairBlockingQueue.poll(long, TimeUnit).protected TitemThe item to exchange.
-
Constructor Summary
Constructors Constructor Description ExchangeCountDownLatch(int i)Creates a new ExchangeCountDownLatch with the given count.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FairBlockingQueue.ItemFuture<T>getFuture()Returns the future the exchanged item is meant for.TgetItem()Returns the exchanged item.voidsetFuture(FairBlockingQueue.ItemFuture<T> future)Sets the future the exchanged item is meant for.voidsetItem(T item)Sets the item to be exchanged.
-
-
-
Field Detail
-
item
protected volatile T item
The item to exchange.
-
future
protected volatile FairBlockingQueue.ItemFuture<T> future
The future the item is exchanged with, set byFairBlockingQueue.pollAsync()and null for the waiters ofFairBlockingQueue.poll(long, TimeUnit).
-
-
Method Detail
-
getItem
public T getItem()
Returns the exchanged item.- Returns:
- the item
-
setItem
public void setItem(T item)
Sets the item to be exchanged.- Parameters:
item- the item
-
getFuture
public FairBlockingQueue.ItemFuture<T> getFuture()
Returns the future the exchanged item is meant for.- Returns:
- the future of an asynchronous poll, or null
-
setFuture
public void setFuture(FairBlockingQueue.ItemFuture<T> future)
Sets the future the exchanged item is meant for.- Parameters:
future- the future of an asynchronous poll
-
-