Package io.vertx.core.http
Class PoolOptions
- java.lang.Object
 - 
- io.vertx.core.http.PoolOptions
 
 
- 
public class PoolOptions extends Object
Options configuring aHttpClientpool.- Author:
 - Julien Viet
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_HTTP2_MAX_POOL_SIZEThe default maximum number of connections an HTTP/2 client will pool = 1static intDEFAULT_MAX_POOL_SIZEThe default maximum number of HTTP/1 connections a client will pool = 5static intDEFAULT_MAX_WAIT_QUEUE_SIZEDefault max wait queue size = -1 (unbounded)static intDEFAULT_MAXIMUM_LIFETIMEDefault maximum pooled connection lifetime = 0 (no maximum)static TimeUnitDEFAULT_MAXIMUM_LIFETIME_TIME_UNITDefault maximum pooled connection lifetime unit = secondsstatic intDEFAULT_POOL_CLEANER_PERIODDefault pool cleaner period = 1000 ms (1 second)static intDEFAULT_POOL_EVENT_LOOP_SIZEDefault pool event loop size = 0 (reuse current event-loop) 
- 
Constructor Summary
Constructors Constructor Description PoolOptions()Default constructorPoolOptions(PoolOptions other)Copy constructorPoolOptions(JsonObject json)Constructor to create an options from JSON 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetCleanerPeriod()intgetEventLoopSize()intgetHttp1MaxSize()Get the maximum pool size for HTTP/1.x connectionsintgetHttp2MaxSize()Get the maximum pool size for HTTP/2 connectionsintgetMaxLifetime()TimeUnitgetMaxLifetimeUnit()intgetMaxWaitQueueSize()Returns the maximum wait queue sizePoolOptionssetCleanerPeriod(int cleanerPeriod)Set the connection pool cleaner period in milli seconds, a non positive value disables expiration checks and connections will remain in the pool until they are closed.PoolOptionssetEventLoopSize(int eventLoopSize)Set the number of event-loop the pool use.PoolOptionssetHttp1MaxSize(int http1MaxSize)Set the maximum pool size for HTTP/1.x connectionsPoolOptionssetHttp2MaxSize(int max)Set the maximum pool size for HTTP/2 connectionsPoolOptionssetMaxLifetime(int maxLifetime)Establish a max lifetime for pooled connections, a value of zero disables the maximum lifetime.PoolOptionssetMaxLifetimeUnit(TimeUnit maxLifetimeUnit)Establish a max lifetime unit for pooled connections.PoolOptionssetMaxWaitQueueSize(int maxWaitQueueSize)Set the maximum requests allowed in the wait queue, any requests beyond the max size will result in a ConnectionPoolTooBusyException.JsonObjecttoJson() 
 - 
 
- 
- 
Field Detail
- 
DEFAULT_MAX_POOL_SIZE
public static final int DEFAULT_MAX_POOL_SIZE
The default maximum number of HTTP/1 connections a client will pool = 5- See Also:
 - Constant Field Values
 
 
- 
DEFAULT_HTTP2_MAX_POOL_SIZE
public static final int DEFAULT_HTTP2_MAX_POOL_SIZE
The default maximum number of connections an HTTP/2 client will pool = 1- See Also:
 - Constant Field Values
 
 
- 
DEFAULT_MAX_WAIT_QUEUE_SIZE
public static final int DEFAULT_MAX_WAIT_QUEUE_SIZE
Default max wait queue size = -1 (unbounded)- See Also:
 - Constant Field Values
 
 
- 
DEFAULT_MAXIMUM_LIFETIME
public static final int DEFAULT_MAXIMUM_LIFETIME
Default maximum pooled connection lifetime = 0 (no maximum)- See Also:
 - Constant Field Values
 
 
- 
DEFAULT_MAXIMUM_LIFETIME_TIME_UNIT
public static final TimeUnit DEFAULT_MAXIMUM_LIFETIME_TIME_UNIT
Default maximum pooled connection lifetime unit = seconds 
- 
DEFAULT_POOL_CLEANER_PERIOD
public static final int DEFAULT_POOL_CLEANER_PERIOD
Default pool cleaner period = 1000 ms (1 second)- See Also:
 - Constant Field Values
 
 
- 
DEFAULT_POOL_EVENT_LOOP_SIZE
public static final int DEFAULT_POOL_EVENT_LOOP_SIZE
Default pool event loop size = 0 (reuse current event-loop)- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Constructor Detail
- 
PoolOptions
public PoolOptions()
Default constructor 
- 
PoolOptions
public PoolOptions(PoolOptions other)
Copy constructor- Parameters:
 other- the options to copy
 
- 
PoolOptions
public PoolOptions(JsonObject json)
Constructor to create an options from JSON- Parameters:
 json- the JSON
 
 - 
 
- 
Method Detail
- 
getHttp1MaxSize
public int getHttp1MaxSize()
Get the maximum pool size for HTTP/1.x connections- Returns:
 - the maximum pool size
 
 
- 
setHttp1MaxSize
public PoolOptions setHttp1MaxSize(int http1MaxSize)
Set the maximum pool size for HTTP/1.x connections- Parameters:
 http1MaxSize- the maximum pool size- Returns:
 - a reference to this, so the API can be used fluently
 
 
- 
getHttp2MaxSize
public int getHttp2MaxSize()
Get the maximum pool size for HTTP/2 connections- Returns:
 - the maximum pool size
 
 
- 
setHttp2MaxSize
public PoolOptions setHttp2MaxSize(int max)
Set the maximum pool size for HTTP/2 connections- Parameters:
 max- the maximum pool size- Returns:
 - a reference to this, so the API can be used fluently
 
 
- 
getMaxLifetimeUnit
public TimeUnit getMaxLifetimeUnit()
- Returns:
 - the pooled connection max lifetime unit
 
 
- 
setMaxLifetimeUnit
public PoolOptions setMaxLifetimeUnit(TimeUnit maxLifetimeUnit)
Establish a max lifetime unit for pooled connections.- Parameters:
 maxLifetimeUnit- pooled connection max lifetime unit- Returns:
 - a reference to this, so the API can be used fluently
 
 
- 
getMaxLifetime
public int getMaxLifetime()
- Returns:
 - pooled connection max lifetime
 
 
- 
setMaxLifetime
public PoolOptions setMaxLifetime(int maxLifetime)
Establish a max lifetime for pooled connections, a value of zero disables the maximum lifetime.- Parameters:
 maxLifetime- the pool connection max lifetime- Returns:
 - a reference to this, so the API can be used fluently
 
 
- 
getCleanerPeriod
public int getCleanerPeriod()
- Returns:
 - the connection pool cleaner period in ms.
 
 
- 
setCleanerPeriod
public PoolOptions setCleanerPeriod(int cleanerPeriod)
Set the connection pool cleaner period in milli seconds, a non positive value disables expiration checks and connections will remain in the pool until they are closed.- Parameters:
 cleanerPeriod- the pool cleaner period- Returns:
 - a reference to this, so the API can be used fluently
 
 
- 
getEventLoopSize
public int getEventLoopSize()
- Returns:
 - the max number of event-loop a pool will use, the default value is 
0which implies to reuse the current event-loop 
 
- 
setEventLoopSize
public PoolOptions setEventLoopSize(int eventLoopSize)
Set the number of event-loop the pool use.- when the size is 
0, the client pool will use the current event-loop - otherwise the client will create and use its own event loop
 
0.- Parameters:
 eventLoopSize- the new size- Returns:
 - a reference to this, so the API can be used fluently
 
 - when the size is 
 
- 
setMaxWaitQueueSize
public PoolOptions setMaxWaitQueueSize(int maxWaitQueueSize)
Set the maximum requests allowed in the wait queue, any requests beyond the max size will result in a ConnectionPoolTooBusyException. If the value is set to a negative number then the queue will be unbounded.- Parameters:
 maxWaitQueueSize- the maximum number of waiting requests- Returns:
 - a reference to this, so the API can be used fluently
 
 
- 
getMaxWaitQueueSize
public int getMaxWaitQueueSize()
Returns the maximum wait queue size- Returns:
 - the maximum wait queue size
 
 
- 
toJson
public JsonObject toJson()
 
 - 
 
 -