public class ConnectionPoolImpl<I,O> extends java.lang.Object implements ConnectionPool<I,O>
Modifier and Type | Field and Description |
---|---|
static PoolExhaustedException |
POOL_EXHAUSTED_EXCEPTION |
Constructor and Description |
---|
ConnectionPoolImpl(RxClient.ServerInfo serverInfo,
PoolConfig poolConfig,
PoolLimitDeterminationStrategy strategy,
java.util.concurrent.ScheduledExecutorService cleanupScheduler,
ClientChannelFactory<I,O> channelFactory,
MetricEventsSubject<ClientMetricsEvent<?>> eventsSubject)
Creates a new connection pool instance.
|
ConnectionPoolImpl(RxClient.ServerInfo serverInfo,
PoolConfig poolConfig,
PoolLimitDeterminationStrategy strategy,
java.util.concurrent.ScheduledExecutorService cleanupScheduler,
ClientConnectionFactory<I,O,PooledConnection<I,O>> connectionFactory,
ClientChannelFactory<I,O> channelFactory,
MetricEventsSubject<ClientMetricsEvent<?>> eventsSubject)
Creates a new connection pool instance.
|
Modifier and Type | Method and Description |
---|---|
rx.Observable<ObservableConnection<I,O>> |
acquire() |
rx.Observable<java.lang.Void> |
discard(PooledConnection<I,O> connection)
Discards the passed connection from the pool.
|
rx.Observable<java.lang.Void> |
release(PooledConnection<I,O> connection) |
void |
shutdown() |
rx.Subscription |
subscribe(MetricEventsListener<? extends ClientMetricsEvent<?>> listener) |
public static final PoolExhaustedException POOL_EXHAUSTED_EXCEPTION
public ConnectionPoolImpl(RxClient.ServerInfo serverInfo, PoolConfig poolConfig, PoolLimitDeterminationStrategy strategy, java.util.concurrent.ScheduledExecutorService cleanupScheduler, ClientChannelFactory<I,O> channelFactory, MetricEventsSubject<ClientMetricsEvent<?>> eventsSubject)
serverInfo
- Server to which this pool connects.poolConfig
- The pool configuration.strategy
- Pool limit determination strategy. This can be null
cleanupScheduler
- Pool idle cleanup scheduler. This can be null
which means there will beeventsSubject
- Metrics event subject to use.public ConnectionPoolImpl(RxClient.ServerInfo serverInfo, PoolConfig poolConfig, PoolLimitDeterminationStrategy strategy, java.util.concurrent.ScheduledExecutorService cleanupScheduler, ClientConnectionFactory<I,O,PooledConnection<I,O>> connectionFactory, ClientChannelFactory<I,O> channelFactory, MetricEventsSubject<ClientMetricsEvent<?>> eventsSubject)
serverInfo
- Server to which this pool connects.poolConfig
- The pool configuration.strategy
- Pool limit determination strategy. This can be null
cleanupScheduler
- Pool idle cleanup scheduler. This can be null
which means there will beeventsSubject
- Metrics event subject to use.public rx.Observable<ObservableConnection<I,O>> acquire()
acquire
in interface ConnectionPool<I,O>
public rx.Observable<java.lang.Void> release(PooledConnection<I,O> connection)
release
in interface ConnectionPool<I,O>
public rx.Observable<java.lang.Void> discard(PooledConnection<I,O> connection)
ConnectionPool
discard
in interface ConnectionPool<I,O>
connection
- The connection to discard.public void shutdown()
shutdown
in interface ConnectionPool<I,O>
public rx.Subscription subscribe(MetricEventsListener<? extends ClientMetricsEvent<?>> listener)
subscribe
in interface MetricEventsPublisher<ClientMetricsEvent<?>>