public class Pool<T> extends 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 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(String[] args) |
String |
toString() |
protected final T[] pool
protected final 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 static void main(String[] args)
Copyright © 2021 JBoss, a division of Red Hat. All rights reserved.