|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectvoldemort.utils.pool.KeyedResourcePool<K,V>
public class KeyedResourcePool<K,V>
A simple implementation of a per-key resource pool.
| Constructor Summary | |
|---|---|
KeyedResourcePool(ResourceFactory<K,V> objectFactory,
ResourcePoolConfig config)
|
|
| Method Summary | ||
|---|---|---|
void |
checkin(K key,
V resource)
Check the given resource back into the pool |
|
V |
checkout(K key)
Checkout a resource if one is immediately available. |
|
void |
close()
Close the pool. |
|
void |
close(K key)
|
|
static
|
create(ResourceFactory<K,V> factory)
Create a new pool using the defaults |
|
static
|
create(ResourceFactory<K,V> factory,
ResourcePoolConfig config)
Create a new pool |
|
int |
getCheckedInResourceCount()
Get the count of resources for all pools currently checkedin |
|
int |
getCheckedInResourcesCount(K k)
Return the number of resources for the given key that are currently sitting idle in the pool waiting to be checked out. |
|
int |
getTotalResourceCount()
Get the count of all resources for all pools |
|
int |
getTotalResourceCount(K k)
Return the total number of resources for the given key whether they are currently checked in or checked out. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public KeyedResourcePool(ResourceFactory<K,V> objectFactory,
ResourcePoolConfig config)
| Method Detail |
|---|
public static <K,V> KeyedResourcePool<K,V> create(ResourceFactory<K,V> factory,
ResourcePoolConfig config)
K - The type of the keysV - The type of the valuesfactory - The factory that creates objectsconfig - The pool config
public static <K,V> KeyedResourcePool<K,V> create(ResourceFactory<K,V> factory)
K - The type of the keysV - The type of the valuesfactory - The factory that creates objects
public V checkout(K key)
throws java.lang.Exception
key - The key to checkout the resource for
java.lang.Exception
public void checkin(K key,
V resource)
throws java.lang.Exception
key - The key for the resourceresource - The resource
java.lang.Exceptionpublic void close()
public void close(K key)
public int getTotalResourceCount(K k)
k - The key
public int getTotalResourceCount()
public int getCheckedInResourcesCount(K k)
k - The key
public int getCheckedInResourceCount()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||