public class Pool<T>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
Pool.Creator<T> |
class |
Pool.Element<T> |
Modifier and Type | Field and Description |
---|---|
protected Pool.Creator<T> |
creator |
protected java.util.concurrent.locks.Lock[] |
locks |
protected T[] |
pool |
Constructor and Description |
---|
Pool(int capacity,
Pool.Creator<T> creator) |
Modifier and Type | Method and Description |
---|---|
Pool.Element<T> |
get()
Gets the next available resource for which the lock can be acquired and returns it and its associated
lock, which needs to be released when the caller is done using the resource.
|
T[] |
getElements() |
int |
getNumLocked() |
static void |
main(java.lang.String[] args) |
java.lang.String |
toString() |
protected final T[] pool
protected final java.util.concurrent.locks.Lock[] locks
protected final Pool.Creator<T> creator
public Pool(int capacity, Pool.Creator<T> creator)
public T[] getElements()
public int getNumLocked()
public Pool.Element<T> get()
public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
Copyright © 1998-2020 Red Hat. All Rights Reserved.