E - endpoint address type, for example SocketAddress for TCP and UDP transportspublic static class SingleEndpointPool.Builder<E> extends Object
SingleEndpointPool.| Modifier and Type | Field and Description |
|---|---|
protected long |
asyncPollTimeoutMillis
Async poll timeout, after which, the async connection poll operation will be failed with a timeout exception
|
protected long |
connectionTTLMillis
the maximum amount of time, a
Connection could stay registered with the pool Once timeout is hit - the
connection will be either closed, if it's idle, or detached from the pool, if it's being used. |
protected org.glassfish.grizzly.ConnectorHandler<E> |
connectorHandler
ConnectorHandler used to establish new Connections |
protected long |
connectTimeoutMillis
Connect timeout, after which, if a connection is not established, it is considered failed
|
protected int |
corePoolSize
The number of
Connections, kept in the pool, that are immune to keep-alive mechanism |
protected org.glassfish.grizzly.utils.DelayedExecutor |
delayedExecutor
the
DelayedExecutor to be used for keep-alive and reconnect mechanisms |
protected Endpoint<E> |
endpoint
The endpoint information
|
protected E |
endpointAddress
Endpoint address
|
protected 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.
|
protected long |
keepAliveCheckIntervalMillis
the interval, which specifies how often the pool will perform idle
Connections check |
protected long |
keepAliveTimeoutMillis
the maximum number of milliseconds an idle
Connection will be kept in the pool. |
protected E |
localEndpointAddress
Local bind address.
|
protected int |
maxPoolSize
The max number of
Connections kept by this pool |
protected int |
maxReconnectAttempts
Maximum number of attempts that will be made to reconnect before notification of failure occurs.
|
protected long |
reconnectDelayMillis
the delay to be used before the pool will repeat the attempt to connect to the endpoint after previous connect had
failed
|
| Modifier | Constructor and Description |
|---|---|
protected |
Builder() |
protected |
Builder(Endpoint<E> endpoint,
org.glassfish.grizzly.ConnectorHandler<E> connectorHandler,
E endpointAddress,
E localEndpointAddress,
int corePoolSize,
int maxPoolSize,
org.glassfish.grizzly.utils.DelayedExecutor delayedExecutor,
long connectTimeoutMillis,
long reconnectDelayMillis,
int maxReconnectAttempts,
long asyncPollTimeoutMillis,
long connectionTTLMillis,
boolean failFastWhenMaxSizeReached,
long keepAliveTimeoutMillis,
long keepAliveCheckIntervalMillis) |
| Modifier and Type | Method and Description |
|---|---|
SingleEndpointPool.Builder<E> |
asyncPollTimeout(long asyncPollTimeout,
TimeUnit timeunit)
Sets the max time consumer will wait for a
Connection to become available. |
SingleEndpointPool<E> |
build()
Constructs
SingleEndpointPool. |
protected SingleEndpointPool<E> |
build0(Endpoint<E> e) |
SingleEndpointPool.Builder<E> |
connectionTTL(long connectionTTL,
TimeUnit timeunit)
Sets the max amount of time a
Connection could be associated with the pool. |
SingleEndpointPool.Builder<E> |
connectorHandler(org.glassfish.grizzly.ConnectorHandler<E> connectorHandler)
Sets the
ConnectorHandler used to establish new Connections. |
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
Connections, kept in the pool, that are immune to keep-alive mechanism. |
SingleEndpointPool.Builder<E> |
delayExecutor(org.glassfish.grizzly.utils.DelayedExecutor delayedExecutor)
Sets the custom
DelayedExecutor to be used for keep-alive and reconnect mechanisms. |
SingleEndpointPool.Builder<E> |
endpoint(Endpoint<E> endpoint)
Sets the endpoint information.
|
SingleEndpointPool.Builder<E> |
endpointAddress(E endpointAddress)
Sets the endpoint address.
|
SingleEndpointPool.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.
|
SingleEndpointPool.Builder<E> |
keepAliveCheckInterval(long keepAliveCheckInterval,
TimeUnit timeunit)
Sets the interval, which specifies how often the pool will perform idle
Connections 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
Connections 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.
|
protected org.glassfish.grizzly.ConnectorHandler<E> connectorHandler
ConnectorHandler used to establish new Connectionsprotected E endpointAddress
protected E localEndpointAddress
protected int corePoolSize
Connections, kept in the pool, that are immune to keep-alive mechanismprotected int maxPoolSize
Connections kept by this poolprotected org.glassfish.grizzly.utils.DelayedExecutor delayedExecutor
DelayedExecutor to be used for keep-alive and reconnect mechanismsprotected long connectTimeoutMillis
protected long reconnectDelayMillis
protected int maxReconnectAttempts
protected long asyncPollTimeoutMillis
protected long connectionTTLMillis
Connection could stay registered with the pool Once timeout is hit - the
connection will be either closed, if it's idle, or detached from the pool, if it's being used.protected boolean failFastWhenMaxSizeReached
protected long keepAliveTimeoutMillis
Connection will be kept in the pool. The idle Connections
will be closed till the pool size is greater than corePoolSizeprotected long keepAliveCheckIntervalMillis
Connections checkprotected Builder()
protected Builder(Endpoint<E> endpoint, org.glassfish.grizzly.ConnectorHandler<E> connectorHandler, E endpointAddress, E localEndpointAddress, int corePoolSize, int maxPoolSize, org.glassfish.grizzly.utils.DelayedExecutor delayedExecutor, long connectTimeoutMillis, long reconnectDelayMillis, int maxReconnectAttempts, long asyncPollTimeoutMillis, long connectionTTLMillis, boolean failFastWhenMaxSizeReached, long keepAliveTimeoutMillis, long keepAliveCheckIntervalMillis)
public SingleEndpointPool.Builder<E> connectorHandler(org.glassfish.grizzly.ConnectorHandler<E> connectorHandler)
ConnectorHandler used to establish new Connections.connectorHandler - ConnectorHandlerSingleEndpointPool.Builderpublic SingleEndpointPool.Builder<E> endpointAddress(E endpointAddress)
endpointAddress - SingleEndpointPool.Builderpublic SingleEndpointPool.Builder<E> localEndpointAddress(E localEndpointAddress)
localEndpointAddress - SingleEndpointPool.Builderpublic SingleEndpointPool.Builder<E> endpoint(Endpoint<E> endpoint)
connectorHandler(org.glassfish.grizzly.ConnectorHandler), endpointAddress(java.lang.Object) and
localEndpointAddress(java.lang.Object) values, if they were or will be set.endpoint - EndpointSingleEndpointPool.Builderpublic SingleEndpointPool.Builder<E> corePoolSize(int corePoolSize)
Connections, kept in the pool, that are immune to keep-alive mechanism. Default value is
0.corePoolSize - SingleEndpointPool.Builderpublic SingleEndpointPool.Builder<E> maxPoolSize(int maxPoolSize)
Connections kept by this pool. Default value is 4.maxPoolSize - SingleEndpointPool.Builderpublic SingleEndpointPool.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 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.Builderpublic 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.Builderpublic 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.Builderpublic SingleEndpointPool.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 SingleEndpointPool.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 SingleEndpointPool.Builder<E> failFastWhenMaxSizeReached(boolean failFastWhenMaxSizeReached)
Connection to become availablefailFastWhenMaxSizeReached - SingleEndpointPool.Builderpublic SingleEndpointPool.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 SingleEndpointPool.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 SingleEndpointPool<E> build()
SingleEndpointPool.SingleEndpointPoolprotected SingleEndpointPool<E> build0(Endpoint<E> e)
Copyright © 2017–2021 Oracle Corporation. All rights reserved.