Package com.github.twitch4j.common.pool
Class AbstractConnectionPool<C>
java.lang.Object
com.github.twitch4j.common.pool.AbstractConnectionPool<C>
- Type Parameters:
C- the connection type
- All Implemented Interfaces:
java.lang.AutoCloseable
- Direct Known Subclasses:
SubscriptionConnectionPool
public abstract class AbstractConnectionPool<C>
extends java.lang.Object
implements java.lang.AutoCloseable
A pool for connections to be created and destroyed.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractConnectionPool.AbstractConnectionPoolBuilder<C,C2 extends AbstractConnectionPool<C>,B extends AbstractConnectionPool.AbstractConnectionPoolBuilder<C,C2,B>> -
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractConnectionPool(AbstractConnectionPool.AbstractConnectionPoolBuilder<C,?,?> b) -
Method Summary
Modifier and Type Method Description voidclose()protected abstract CcreateConnection()protected abstract voiddisposeConnection(C connection)protected abstract java.lang.Iterable<C>getConnections()intnumConnections()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
AbstractConnectionPool
-
-
Method Details
-
createConnection
-
disposeConnection
-
getConnections
-
close
public void close()- Specified by:
closein interfacejava.lang.AutoCloseable
-
numConnections
public int numConnections()- Returns:
- the number of open connections held by this pool.
-