|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvoldemort.utils.pool.KeyedResourcePool<K,V>
voldemort.utils.pool.QueuedKeyedResourcePool<K,V>
public class QueuedKeyedResourcePool<K,V>
Extends simple implementation of a per-key resource pool with a non-blocking
interface to enqueue requests for a resource when one becomes available.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class voldemort.utils.pool.KeyedResourcePool |
---|
KeyedResourcePool.Pool<V> |
Constructor Summary | |
---|---|
QueuedKeyedResourcePool(ResourceFactory<K,V> objectFactory,
ResourcePoolConfig config)
|
Method Summary | ||
---|---|---|
void |
checkin(K key,
V resource)
Check the given resource back into the pool |
|
void |
close()
Close the queue and the pool. |
|
static
|
create(ResourceFactory<K,V> factory)
Create a new queued pool using the defaults for key of tyep K, request of type R, and value of Type V. |
|
static
|
create(ResourceFactory<K,V> factory,
ResourcePoolConfig config)
Create a new queued pool with key type K, request type R, and value type V. |
|
protected void |
destroyRequest(AsyncResourceRequest<V> resourceRequest)
A safe wrapper to destroy the given resource request. |
|
int |
getRegisteredResourceRequestCount()
Count the total number of queued resource requests for all queues. |
|
int |
getRegisteredResourceRequestCount(K key)
Count the number of queued resource requests for a specific pool. |
|
protected java.util.Queue<AsyncResourceRequest<V>> |
getRequestQueueForExistingKey(K key)
|
|
protected java.util.Queue<AsyncResourceRequest<V>> |
getRequestQueueForKey(K key)
|
|
protected boolean |
internalClose()
|
|
void |
registerResourceRequest(K key,
AsyncResourceRequest<V> resourceRequest)
This method is the asynchronous (nonblocking) version of KeyedResourcePool.checkout. |
Methods inherited from class voldemort.utils.pool.KeyedResourcePool |
---|
attemptNonBlockingCheckout, checkNotClosed, checkout, destroyResource, getBlockingGetsCount, getBlockingGetsCount, getCheckedInResourceCount, getCheckedInResourcesCount, getResourcePoolForExistingKey, getResourcePoolForKey, getTotalResourceCount, getTotalResourceCount, isOpenAndValid, reset |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public QueuedKeyedResourcePool(ResourceFactory<K,V> objectFactory, ResourcePoolConfig config)
Method Detail |
---|
public static <K,V> QueuedKeyedResourcePool<K,V> create(ResourceFactory<K,V> factory, ResourcePoolConfig config)
factory
- The factory that creates objectsconfig
- The pool config
public static <K,V> QueuedKeyedResourcePool<K,V> create(ResourceFactory<K,V> factory)
factory
- The factory that creates objects
public void registerResourceRequest(K key, AsyncResourceRequest<V> resourceRequest)
key
- The key to checkout the resource forpublic void checkin(K key, V resource) throws java.lang.Exception
checkin
in class KeyedResourcePool<K,V>
key
- The key for the resourceresource
- The resource
java.lang.Exception
protected void destroyRequest(AsyncResourceRequest<V> resourceRequest)
protected boolean internalClose()
internalClose
in class KeyedResourcePool<K,V>
public void close()
close
in class KeyedResourcePool<K,V>
protected java.util.Queue<AsyncResourceRequest<V>> getRequestQueueForKey(K key)
protected java.util.Queue<AsyncResourceRequest<V>> getRequestQueueForExistingKey(K key)
public int getRegisteredResourceRequestCount(K key)
key
- The key
public int getRegisteredResourceRequestCount()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |