public interface BlockingPool<T> extends Pool<T>
Pool.Dispose<T>, Pool.Validator<T>| 限定符和类型 | 方法和说明 |
|---|---|
void |
put(T e)
Inserts the specified element into this queue, waiting if necessary for
space to become available.
|
boolean |
put(T e,
long timeout,
TimeUnit unit)
Inserts the specified element into this queue, waiting up to the
specified wait time if necessary for space to become available.
|
T |
take()
Returns an instance of type T from the pool.
|
T |
take(long time,
TimeUnit unit)
Returns an instance of type T from the pool, waiting up to the specified
wait time if necessary for an object to become available..
|
T take() throws InterruptedException
InterruptedExceptionT take(long time, TimeUnit unit) throws InterruptedException
time - amount of time to wait before giving up, in units of unitunit - a TimeUnit determining how to interpret the timeout parameterInterruptedException - if interrupted while waitingvoid put(T e) throws InterruptedException
e - the element to addInterruptedException - if interrupted while waitingClassCastException - if the class of the specified element prevents it from being
added to this queueNullPointerException - if the specified element is nullIllegalArgumentException - if some property of the specified element prevents it from
being added to this queueboolean put(T e, long timeout, TimeUnit unit) throws InterruptedException
e - the element to addtimeout - how long to wait before giving up, in units of unitunit - a TimeUnit determining how to interpret the
timeout parametertrue if successful, or false if the specified
waiting time elapses before space is availableInterruptedException - if interrupted while waitingClassCastException - if the class of the specified element prevents it from being
added to this queueNullPointerException - if the specified element is nullIllegalArgumentException - if some property of the specified element prevents it from
being added to this queueCopyright © 2016. All rights reserved.