public class TrackedConnectionList
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
TrackedConnectionList.Node
A node in the doubly-linked list holding a weak reference to a connection.
|
| Constructor and Description |
|---|
TrackedConnectionList() |
| Modifier and Type | Method and Description |
|---|---|
TrackedConnectionList.Node |
add(java.sql.Connection connection)
Adds a connection to the tail of the list.
|
void |
appendTo(java.lang.StringBuilder builder)
Iterates over all nodes and collects connection string representations.
|
java.util.List<java.sql.Connection> |
drainAll()
Removes all nodes from the list and returns the connections.
|
boolean |
isEmpty() |
void |
remove(TrackedConnectionList.Node node)
Removes a node from the list in O(1) time.
|
void |
removeIf(java.util.function.Predicate<java.lang.ref.WeakReference<java.sql.Connection>> predicate)
Removes nodes matching the predicate.
|
int |
size() |
public TrackedConnectionList.Node add(java.sql.Connection connection)
connection - the connection to trackpublic void remove(TrackedConnectionList.Node node)
node - the node to removepublic java.util.List<java.sql.Connection> drainAll()
public void removeIf(java.util.function.Predicate<java.lang.ref.WeakReference<java.sql.Connection>> predicate)
predicate - test applied to each node's weak referencepublic boolean isEmpty()
public int size()
public void appendTo(java.lang.StringBuilder builder)
builder - the StringBuilder to append to