E
- endpoint address type, for example SocketAddress
for TCP and UDP transportspublic static class SingleEndpointPool.Builder<E> extends Object
SingleEndpointPool
.Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
SingleEndpointPool<E> |
build()
Constructs
SingleEndpointPool . |
SingleEndpointPool.Builder<E> |
connectorHandler(ConnectorHandler<E> connectorHandler)
Sets the
ConnectorHandler used to establish new Connection s. |
SingleEndpointPool.Builder<E> |
connectTimeout(long connectTimeout,
TimeUnit timeunit)
Sets the max time
Connection connect operation may take. |
SingleEndpointPool.Builder<E> |
corePoolSize(int corePoolSize)
Sets the number of
Connection s, kept in the pool,
that are immune to keep-alive mechanism. |
SingleEndpointPool.Builder<E> |
delayExecutor(DelayedExecutor delayedExecutor)
Sets the custom
DelayedExecutor to be used for keep-alive and
reconnect mechanisms. |
SingleEndpointPool.Builder<E> |
endpointAddress(E endpointAddress)
Sets the endpoint address.
|
SingleEndpointPool.Builder<E> |
keepAliveCheckInterval(long keepAliveCheckInterval,
TimeUnit timeunit)
Sets the interval, which specifies how often the pool will perform
idle
Connection s check. |
SingleEndpointPool.Builder<E> |
keepAliveTimeout(long keepAliveTimeout,
TimeUnit timeunit)
Sets the maximum number of milliseconds an idle
Connection
will be kept in the pool. |
SingleEndpointPool.Builder<E> |
localEndpointAddress(E localEndpointAddress)
Sets the local endpoint address.
|
SingleEndpointPool.Builder<E> |
maxPoolSize(int maxPoolSize)
Sets the max number of
Connection s kept by this pool. |
SingleEndpointPool.Builder<E> |
maxReconnectAttempts(int maxReconnectAttempts)
If the reconnect mechanism is enabled, then this property will affect
how many times a reconnection attempt can be made consecutively before
a failure is flagged.
|
SingleEndpointPool.Builder<E> |
reconnectDelay(long reconnectDelay,
TimeUnit timeunit)
Sets the delay to be used before the pool will repeat the attempt to
connect to the endpoint after previous connect operation had failed.
|
public SingleEndpointPool.Builder<E> connectorHandler(ConnectorHandler<E> connectorHandler)
ConnectorHandler
used to establish new Connection
s.connectorHandler
- ConnectorHandler
SingleEndpointPool.Builder
public SingleEndpointPool.Builder<E> endpointAddress(E endpointAddress)
endpointAddress
- SingleEndpointPool.Builder
public SingleEndpointPool.Builder<E> localEndpointAddress(E localEndpointAddress)
SingleEndpointPool.Builder
public SingleEndpointPool.Builder<E> corePoolSize(int corePoolSize)
Connection
s, kept in the pool,
that are immune to keep-alive mechanism.
Default value is 0.corePoolSize
- SingleEndpointPool.Builder
public SingleEndpointPool.Builder<E> maxPoolSize(int maxPoolSize)
Connection
s kept by this pool.
Default value is 4.maxPoolSize
- SingleEndpointPool.Builder
public SingleEndpointPool.Builder<E> delayExecutor(DelayedExecutor delayedExecutor)
DelayedExecutor
to be used for keep-alive and
reconnect mechanisms.
If none is set - the SingleEndpointPool
will create its own DelayedExecutor
.delayedExecutor
- SingleEndpointPool.Builder
public SingleEndpointPool.Builder<E> connectTimeout(long connectTimeout, TimeUnit timeunit)
Connection
connect operation may take.
If timeout expires - the connect operation is considered failed.
If connectTimeout < 0 - the connect timeout mechanism will be disabled.
By default the connect timeout mechanism is disabled.connectTimeout
- the max time Connection
connect
operation may take. If timeout expires - the connect operation
is considered failed. The negative value disables the
connect timeout mechanism.timeunit
- a TimeUnit determining how to interpret the
timeout parameterSingleEndpointPool.Builder
public SingleEndpointPool.Builder<E> reconnectDelay(long reconnectDelay, TimeUnit timeunit)
reconnectDelay
- the delay to be used before the pool will repeat
the attempt to connect to the endpoint after previous connect
operation had failed. The negative value disables the
reconnect mechanism.timeunit
- a TimeUnit determining how to interpret the
timeout parameterSingleEndpointPool.Builder
public SingleEndpointPool.Builder<E> maxReconnectAttempts(int maxReconnectAttempts)
maxReconnectAttempts
- the maximum number of reconnect attempts.
If the reconnect mechanism isn't enabled, this property is ignored.SingleEndpointPool.Builder
public SingleEndpointPool.Builder<E> keepAliveTimeout(long keepAliveTimeout, TimeUnit timeunit)
Connection
will be kept in the pool.
The idle Connection
s will be closed till the pool size is
greater than corePoolSize.
If keepAliveTimeout < 0 - the keep-alive mechanism will be disabled.
By default the keep-alive timeout is set to 30 seconds.keepAliveTimeout
- the maximum number of milliseconds an idle
Connection
will be kept in the pool. The negative
value disables the keep-alive mechanism.timeunit
- a TimeUnit determining how to interpret the
timeout parameterSingleEndpointPool.Builder
public SingleEndpointPool.Builder<E> keepAliveCheckInterval(long keepAliveCheckInterval, TimeUnit timeunit)
Connection
s check.keepAliveCheckInterval
- the interval, which specifies how often the
pool will perform idle Connection
s checktimeunit
- a TimeUnit determining how to interpret the
timeout parameterSingleEndpointPool.Builder
public SingleEndpointPool<E> build()
SingleEndpointPool
.SingleEndpointPool
Copyright © 2014 Oracle Corporation. All rights reserved.