Package org.apache.druid.collections
Interface BlockingPool<T>
-
- All Known Implementing Classes:
DefaultBlockingPool
,DummyBlockingPool
public interface BlockingPool<T>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
getPendingRequests()
Returns the count of the requests waiting to acquire a batch of resources.int
maxSize()
List<ReferenceCountingResourceHolder<T>>
takeBatch(int elementNum)
Take resources from the pool, waiting if necessary until the elements of the given number become available.List<ReferenceCountingResourceHolder<T>>
takeBatch(int elementNum, long timeoutMs)
Take resources from the pool, waiting up to the specified wait time if necessary for elements of the given number to become available.
-
-
-
Method Detail
-
maxSize
int maxSize()
-
takeBatch
List<ReferenceCountingResourceHolder<T>> takeBatch(int elementNum, long timeoutMs)
Take resources from the pool, waiting up to the specified wait time if necessary for elements of the given number to become available.- Parameters:
elementNum
- number of resources to taketimeoutMs
- maximum time to wait for resources, in milliseconds.- Returns:
- a list of resource holders. An empty list is returned if
elementNum
resources aren't available.
-
takeBatch
List<ReferenceCountingResourceHolder<T>> takeBatch(int elementNum)
Take resources from the pool, waiting if necessary until the elements of the given number become available.- Parameters:
elementNum
- number of resources to take- Returns:
- a list of resource holders. An empty list is returned if
elementNum
resources aren't available.
-
getPendingRequests
long getPendingRequests()
Returns the count of the requests waiting to acquire a batch of resources.- Returns:
- count of pending requests
-
-