Class ConnectionPoolConfigurationBuilder
- java.lang.Object
-
- org.infinispan.client.hotrod.configuration.AbstractConfigurationChildBuilder
-
- org.infinispan.client.hotrod.configuration.ConnectionPoolConfigurationBuilder
-
- All Implemented Interfaces:
ConfigurationChildBuilder
,Builder<ConnectionPoolConfiguration>
public class ConnectionPoolConfigurationBuilder extends AbstractConfigurationChildBuilder implements Builder<ConnectionPoolConfiguration>
ConnectionPoolConfigurationBuilder. Specifies connection pooling properties for the HotRod client.- Since:
- 5.3
- Author:
- Tristan Tarrant
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConnectionPoolConfiguration
create()
Create the configuration beanConnectionPoolConfigurationBuilder
exhaustedAction(ExhaustedAction exhaustedAction)
Specifies what happens when asking for a connection from a server's pool, and that pool is exhausted.ConnectionPoolConfigurationBuilder
maxActive(int maxActive)
Controls the maximum number of connections per server that are allocated (checked out to client threads, or idle in the pool) at one time.ConnectionPoolConfigurationBuilder
maxPendingRequests(int maxPendingRequests)
Specifies maximum number of requests sent over single connection at one instant.ConnectionPoolConfigurationBuilder
maxWait(long maxWait)
The amount of time in milliseconds to wait for a connection to become available when the exhausted action isExhaustedAction.WAIT
, after which aNoSuchElementException
will be thrown.ConnectionPoolConfigurationBuilder
minEvictableIdleTime(long minEvictableIdleTime)
Specifies the minimum amount of time that an connection may sit idle in the pool before it is eligible for eviction due to idle time.ConnectionPoolConfigurationBuilder
minIdle(int minIdle)
Sets a target value for the minimum number of idle connections (per server) that should always be available.ConnectionPoolConfigurationBuilder
read(ConnectionPoolConfiguration template)
Reads the configuration from an already created configuration bean into this builder.void
validate()
Validate the data in this builder before building the configuration beanConnectionPoolConfigurationBuilder
withPoolProperties(Properties properties)
Configures the connection pool parameter according to properties-
Methods inherited from class org.infinispan.client.hotrod.configuration.AbstractConfigurationChildBuilder
addCluster, addContextInitializer, addContextInitializer, addContextInitializers, addJavaSerialWhiteList, addServer, addServers, asyncExecutorFactory, balancingStrategy, balancingStrategy, balancingStrategy, balancingStrategy, batchSize, build, classLoader, clientIntelligence, connectionPool, connectionTimeout, consistentHashImpl, consistentHashImpl, forceReturnValues, keySizeEstimate, marshaller, marshaller, marshaller, maxRetries, protocolVersion, remoteCache, security, socketTimeout, statistics, tcpKeepAlive, tcpNoDelay, transaction, valueSizeEstimate, version, withProperties
-
-
-
-
Method Detail
-
exhaustedAction
public ConnectionPoolConfigurationBuilder exhaustedAction(ExhaustedAction exhaustedAction)
Specifies what happens when asking for a connection from a server's pool, and that pool is exhausted.
-
maxActive
public ConnectionPoolConfigurationBuilder maxActive(int maxActive)
Controls the maximum number of connections per server that are allocated (checked out to client threads, or idle in the pool) at one time. When non-positive, there is no limit to the number of connections per server. When maxActive is reached, the connection pool for that server is said to be exhausted. The default setting for this parameter is -1, i.e. there is no limit.
-
maxWait
public ConnectionPoolConfigurationBuilder maxWait(long maxWait)
The amount of time in milliseconds to wait for a connection to become available when the exhausted action isExhaustedAction.WAIT
, after which aNoSuchElementException
will be thrown. If a negative value is supplied, the pool will block indefinitely.
-
minIdle
public ConnectionPoolConfigurationBuilder minIdle(int minIdle)
Sets a target value for the minimum number of idle connections (per server) that should always be available. If this parameter is set to a positive number and timeBetweenEvictionRunsMillis > 0, each time the idle connection eviction thread runs, it will try to create enough idle instances so that there will be minIdle idle instances available for each server. The default setting for this parameter is 1.
-
minEvictableIdleTime
public ConnectionPoolConfigurationBuilder minEvictableIdleTime(long minEvictableIdleTime)
Specifies the minimum amount of time that an connection may sit idle in the pool before it is eligible for eviction due to idle time. When non-positive, no connection will be dropped from the pool due to idle time alone. This setting has no effect unless timeBetweenEvictionRunsMillis > 0. The default setting for this parameter is 1800000(30 minutes).
-
maxPendingRequests
public ConnectionPoolConfigurationBuilder maxPendingRequests(int maxPendingRequests)
Specifies maximum number of requests sent over single connection at one instant. Connections with more concurrent requests will be ignored in the pool when choosing available connection and the pool will try to create a new connection if all connections are utilized. Only if the new connection cannot be created and theexhausted action
is set toExhaustedAction.WAIT
the pool will allow sending the request over one of the over-utilized connections. The rule of thumb is that this should be set to higher values if the values are small (< 1kB) and to lower values if the entries are big (> 10kB). Default setting for this parameter is 5.
-
withPoolProperties
public ConnectionPoolConfigurationBuilder withPoolProperties(Properties properties)
Configures the connection pool parameter according to properties
-
validate
public void validate()
Description copied from interface:Builder
Validate the data in this builder before building the configuration bean- Specified by:
validate
in interfaceBuilder<ConnectionPoolConfiguration>
-
create
public ConnectionPoolConfiguration create()
Description copied from interface:Builder
Create the configuration bean- Specified by:
create
in interfaceBuilder<ConnectionPoolConfiguration>
- Returns:
-
read
public ConnectionPoolConfigurationBuilder read(ConnectionPoolConfiguration template)
Description copied from interface:Builder
Reads the configuration from an already created configuration bean into this builder. Returns an appropriate builder to allow fluent configuration- Specified by:
read
in interfaceBuilder<ConnectionPoolConfiguration>
- Parameters:
template
- the configuration from which to "clone" this config if needed.
-
-