E - endpoint address type, for example SocketAddress for TCP and UDP transportspublic static class MultiEndpointPool.Builder<E> extends Object
SingleEndpointPool.| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
MultiEndpointPool.Builder<E> |
asyncPollTimeout(long asyncPollTimeout,
TimeUnit timeunit)
Sets the max time consumer will wait for a
Connection to
become available. |
MultiEndpointPool<E> |
build()
Constructs
MultiEndpointPool. |
MultiEndpointPool.Builder<E> |
connectionTTL(long connectionTTL,
TimeUnit timeunit)
Sets the max amount of time a
Connection could be associated
with the pool. |
MultiEndpointPool.Builder<E> |
connectorHandler(org.glassfish.grizzly.ConnectorHandler<E> defaultConnectorHandler)
Deprecated.
Endpoint must always know how to establish the connection |
MultiEndpointPool.Builder<E> |
connectTimeout(long connectTimeout,
TimeUnit timeunit)
Sets the max time
Connection connect operation may take. |
MultiEndpointPool.Builder<E> |
delayExecutor(org.glassfish.grizzly.utils.DelayedExecutor delayedExecutor)
Sets the custom
DelayedExecutor to be used for keep-alive and
reconnect mechanisms. |
MultiEndpointPool.Builder<E> |
endpointPoolCustomizer(MultiEndpointPool.EndpointPoolCustomizer<E> endpointPoolCustomizer)
Set the customizer, which will be used to modify a specific endpoint pool
settings and overwrite the default settings assigned by
this MultiEndpointPool.
|
MultiEndpointPool.Builder<E> |
failFastWhenMaxSizeReached(boolean failFastWhenMaxSizeReached)
if true, the "take" method will fail fast if there is no
free connection in the pool and max pool size is reached.
|
MultiEndpointPool.Builder<E> |
keepAliveCheckInterval(long keepAliveCheckInterval,
TimeUnit timeunit)
Sets the interval, which specifies how often the pool will perform
idle
Connections check. |
MultiEndpointPool.Builder<E> |
keepAliveTimeout(long keepAliveTimeout,
TimeUnit timeunit)
Sets the maximum number of milliseconds an idle
Connection
will be kept in the pool. |
MultiEndpointPool.Builder<E> |
maxConnectionsPerEndpoint(int maxConnectionsPerEndpoint)
Sets the maximum number of
Connections to a single endpoint
the pool is allowed to have. |
MultiEndpointPool.Builder<E> |
maxConnectionsTotal(int maxConnectionsTotal)
Sets the maximum number of
Connections the pool is allowed to have. |
MultiEndpointPool.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.
|
MultiEndpointPool.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 MultiEndpointPool.Builder<E> connectorHandler(org.glassfish.grizzly.ConnectorHandler<E> defaultConnectorHandler)
Endpoint must always know how to establish the connectionConnectorHandler to be used to establish new
Connections if none is specified by Endpoint.defaultConnectorHandler - ConnectorHandlerSingleEndpointPool.Builderpublic MultiEndpointPool.Builder<E> maxConnectionsPerEndpoint(int maxConnectionsPerEndpoint)
Connections to a single endpoint
the pool is allowed to have.
Default value is 2.maxConnectionsPerEndpoint - SingleEndpointPool.Builderpublic MultiEndpointPool.Builder<E> maxConnectionsTotal(int maxConnectionsTotal)
Connections the pool is allowed to have.
Default value is 16.maxConnectionsTotal - SingleEndpointPool.Builderpublic MultiEndpointPool.Builder<E> delayExecutor(org.glassfish.grizzly.utils.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.Builderpublic MultiEndpointPool.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.Builderpublic MultiEndpointPool.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.Builderpublic MultiEndpointPool.Builder<E> maxReconnectAttempts(int maxReconnectAttempts)
maxReconnectAttempts - the maximum number of reconnect attempts.
If the reconnect mechanism isn't enabled, this property is ignored.SingleEndpointPool.Builderpublic MultiEndpointPool.Builder<E> asyncPollTimeout(long asyncPollTimeout, TimeUnit timeunit)
Connection to
become available. When timeout expires the consumer will
be notified about the failure (TimeoutException)
via CompletionHandler or Future.
If asyncPollTimeout < 0 - timeout will not be set.
By default the timeout is not set and consumer may wait forever for
a Connection.asyncPollTimeout - the maximum time, the async poll operation
could wait for a connection to become availabletimeunit - a TimeUnit determining how to interpret the
timeout parameterSingleEndpointPool.Builderpublic MultiEndpointPool.Builder<E> connectionTTL(long connectionTTL, TimeUnit timeunit)
Connection could be associated
with the pool.
Once timeout expired the Connection will be either closed,
if it's idle, or detached from the pool, if it's being used.
If connectionTTL < 0 - the Connection time to live will
not be set and the Connection can be associated with
a pool forever, if no other limit is hit (like keep-alive).
By default the connectionTTL is not set.connectionTTL - the max amount of time a Connection could be associated
with the pooltimeunit - a TimeUnit determining how to interpret the
connectionTTL parameterSingleEndpointPool.Builderpublic MultiEndpointPool.Builder<E> failFastWhenMaxSizeReached(boolean failFastWhenMaxSizeReached)
Connection
to become availablefailFastWhenMaxSizeReached - SingleEndpointPool.Builderpublic MultiEndpointPool.Builder<E> keepAliveTimeout(long keepAliveTimeout, TimeUnit timeunit)
Connection
will be kept in the pool.
The idle Connections 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.Builderpublic MultiEndpointPool.Builder<E> keepAliveCheckInterval(long keepAliveCheckInterval, TimeUnit timeunit)
Connections check.keepAliveCheckInterval - the interval, which specifies how often the
pool will perform idle Connections checktimeunit - a TimeUnit determining how to interpret the
timeout parameterSingleEndpointPool.Builderpublic MultiEndpointPool.Builder<E> endpointPoolCustomizer(MultiEndpointPool.EndpointPoolCustomizer<E> endpointPoolCustomizer)
endpointPoolCustomizer - MultiEndpointPool.EndpointPoolCustomizerSingleEndpointPool.Builderpublic MultiEndpointPool<E> build()
MultiEndpointPool.MultiEndpointPoolCopyright © 2018 Oracle Corporation. All Rights Reserved.