Class VertxOptions
- java.lang.Object
-
- io.vertx.core.VertxOptions
-
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_BLOCKED_THREAD_CHECK_INTERVALThe default value of blocked thread check interval = 1000 ms.static TimeUnitDEFAULT_BLOCKED_THREAD_CHECK_INTERVAL_UNITThe default value of blocked thread check interval unit =TimeUnit.MILLISECONDSstatic booleanDEFAULT_DISABLE_TCCLThe default value of thread context classloader disabling =falsestatic intDEFAULT_EVENT_LOOP_POOL_SIZEThe default number of event loop threads to be used = 2 * number of cores on the machinestatic booleanDEFAULT_HA_ENABLEDThe default value of HA enabled = falsestatic StringDEFAULT_HA_GROUPThe default value of Ha group is "__DEFAULT__"static intDEFAULT_INTERNAL_BLOCKING_POOL_SIZEThe default number of threads in the internal blocking pool (used by some internal operations) = 20static longDEFAULT_MAX_EVENT_LOOP_EXECUTE_TIMEThe default value of max event loop execute time = 2000000000 ns (2 seconds)static TimeUnitDEFAULT_MAX_EVENT_LOOP_EXECUTE_TIME_UNITThe default value of max event loop execute time unit =TimeUnit.NANOSECONDSstatic longDEFAULT_MAX_WORKER_EXECUTE_TIMEThe default value of max worker execute time = 60000000000 ns (60 seconds)static TimeUnitDEFAULT_MAX_WORKER_EXECUTE_TIME_UNITThe default value of max worker execute time unit =TimeUnit.NANOSECONDSstatic booleanDEFAULT_PREFER_NATIVE_TRANSPORTThe default value for preferring native transport = falsestatic intDEFAULT_QUORUM_SIZEThe default value of quorum size = 1static booleanDEFAULT_USE_DAEMON_THREADSet default value to false for aligning with the old behavior By default, Vert.x threads are NOT daemons - we want them to prevent JVM exit so embedded user doesn't have to explicitly prevent JVM from exiting.static TimeUnitDEFAULT_WARNING_EXCEPTION_TIME_UNITThe default value of warning exception time unit =TimeUnit.NANOSECONDSstatic intDEFAULT_WORKER_POOL_SIZEThe default number of threads in the worker pool = 20
-
Constructor Summary
Constructors Constructor Description VertxOptions()Default constructorVertxOptions(JsonObject json)Create an instance from aJsonObjectVertxOptions(VertxOptions other)Copy constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AddressResolverOptionsgetAddressResolverOptions()longgetBlockedThreadCheckInterval()Get the value of blocked thread check period, inblockedThreadCheckIntervalUnit.TimeUnitgetBlockedThreadCheckIntervalUnit()booleangetDisableTCCL()EventBusOptionsgetEventBusOptions()intgetEventLoopPoolSize()Get the number of event loop threads to be used by the Vert.x instance.FileSystemOptionsgetFileSystemOptions()StringgetHAGroup()Get the HA group to be used when HA is enabled.intgetInternalBlockingPoolSize()Get the value of internal blocking pool size.longgetMaxEventLoopExecuteTime()Get the value of max event loop execute time, inmaxEventLoopExecuteTimeUnit.TimeUnitgetMaxEventLoopExecuteTimeUnit()longgetMaxWorkerExecuteTime()Get the value of max worker execute time, inmaxWorkerExecuteTimeUnit.TimeUnitgetMaxWorkerExecuteTimeUnit()MetricsOptionsgetMetricsOptions()booleangetPreferNativeTransport()intgetQuorumSize()Get the quorum size to be used when HA is enabled.TracingOptionsgetTracingOptions()If tracing is disabled, the value will benull.BooleangetUseDaemonThread()Returns whether we want to use daemon vertx thread.longgetWarningExceptionTime()Get the threshold value above this, the blocked warning contains a stack trace. inwarningExceptionTimeUnit.TimeUnitgetWarningExceptionTimeUnit()intgetWorkerPoolSize()Get the maximum number of worker threads to be used by the Vert.x instance.booleanisHAEnabled()Will HA be enabled on the Vert.x instance?VertxOptionssetAddressResolverOptions(AddressResolverOptions addressResolverOptions)Sets the address resolver configuration to configure resolving DNS servers, cache TTL, etc...VertxOptionssetBlockedThreadCheckInterval(long blockedThreadCheckInterval)Sets the value of blocked thread check period, inblockedThreadCheckIntervalUnit.VertxOptionssetBlockedThreadCheckIntervalUnit(TimeUnit blockedThreadCheckIntervalUnit)Set the time unit ofblockedThreadCheckInterval.VertxOptionssetDisableTCCL(boolean disableTCCL)VertxOptionssetEventBusOptions(EventBusOptions options)Sets the event bus configuration to configure the host, port, ssl...VertxOptionssetEventLoopPoolSize(int eventLoopPoolSize)Set the number of event loop threads to be used by the Vert.x instance.VertxOptionssetFileSystemOptions(FileSystemOptions fileSystemOptions)Set the file system optionsVertxOptionssetHAEnabled(boolean haEnabled)Set whether HA will be enabled on the Vert.x instance.VertxOptionssetHAGroup(String haGroup)Set the HA group to be used when HA is enabled.VertxOptionssetInternalBlockingPoolSize(int internalBlockingPoolSize)Set the value of internal blocking pool sizeVertxOptionssetMaxEventLoopExecuteTime(long maxEventLoopExecuteTime)Sets the value of max event loop execute time, inmaxEventLoopExecuteTimeUnit.VertxOptionssetMaxEventLoopExecuteTimeUnit(TimeUnit maxEventLoopExecuteTimeUnit)Set the time unit ofmaxEventLoopExecuteTime.VertxOptionssetMaxWorkerExecuteTime(long maxWorkerExecuteTime)Sets the value of max worker execute time, inmaxWorkerExecuteTimeUnit.VertxOptionssetMaxWorkerExecuteTimeUnit(TimeUnit maxWorkerExecuteTimeUnit)Set the time unit ofmaxWorkerExecuteTime.VertxOptionssetMetricsOptions(MetricsOptions metrics)Set the metrics optionsVertxOptionssetPreferNativeTransport(boolean preferNativeTransport)Set whether to prefer the native transport to the NIO transport.VertxOptionssetQuorumSize(int quorumSize)Set the quorum size to be used when HA is enabled.VertxOptionssetTracingOptions(TracingOptions tracingOptions)Set the tracing optionsVertxOptionssetUseDaemonThread(Boolean daemon)Mark the vertx thread as daemon thread or user thread.VertxOptionssetWarningExceptionTime(long warningExceptionTime)Set the threshold value above this, the blocked warning contains a stack trace. inwarningExceptionTimeUnit.VertxOptionssetWarningExceptionTimeUnit(TimeUnit warningExceptionTimeUnit)Set the time unit ofwarningExceptionTime.VertxOptionssetWorkerPoolSize(int workerPoolSize)Set the maximum number of worker threads to be used by the Vert.x instance.JsonObjecttoJson()StringtoString()
-
-
-
Field Detail
-
DEFAULT_EVENT_LOOP_POOL_SIZE
public static final int DEFAULT_EVENT_LOOP_POOL_SIZE
The default number of event loop threads to be used = 2 * number of cores on the machine
-
DEFAULT_WORKER_POOL_SIZE
public static final int DEFAULT_WORKER_POOL_SIZE
The default number of threads in the worker pool = 20- See Also:
- Constant Field Values
-
DEFAULT_INTERNAL_BLOCKING_POOL_SIZE
public static final int DEFAULT_INTERNAL_BLOCKING_POOL_SIZE
The default number of threads in the internal blocking pool (used by some internal operations) = 20- See Also:
- Constant Field Values
-
DEFAULT_BLOCKED_THREAD_CHECK_INTERVAL
public static final long DEFAULT_BLOCKED_THREAD_CHECK_INTERVAL
The default value of blocked thread check interval = 1000 ms.
-
DEFAULT_BLOCKED_THREAD_CHECK_INTERVAL_UNIT
public static final TimeUnit DEFAULT_BLOCKED_THREAD_CHECK_INTERVAL_UNIT
The default value of blocked thread check interval unit =TimeUnit.MILLISECONDS
-
DEFAULT_MAX_EVENT_LOOP_EXECUTE_TIME
public static final long DEFAULT_MAX_EVENT_LOOP_EXECUTE_TIME
The default value of max event loop execute time = 2000000000 ns (2 seconds)
-
DEFAULT_MAX_EVENT_LOOP_EXECUTE_TIME_UNIT
public static final TimeUnit DEFAULT_MAX_EVENT_LOOP_EXECUTE_TIME_UNIT
The default value of max event loop execute time unit =TimeUnit.NANOSECONDS
-
DEFAULT_MAX_WORKER_EXECUTE_TIME
public static final long DEFAULT_MAX_WORKER_EXECUTE_TIME
The default value of max worker execute time = 60000000000 ns (60 seconds)
-
DEFAULT_MAX_WORKER_EXECUTE_TIME_UNIT
public static final TimeUnit DEFAULT_MAX_WORKER_EXECUTE_TIME_UNIT
The default value of max worker execute time unit =TimeUnit.NANOSECONDS
-
DEFAULT_QUORUM_SIZE
public static final int DEFAULT_QUORUM_SIZE
The default value of quorum size = 1- See Also:
- Constant Field Values
-
DEFAULT_HA_GROUP
public static final String DEFAULT_HA_GROUP
The default value of Ha group is "__DEFAULT__"- See Also:
- Constant Field Values
-
DEFAULT_HA_ENABLED
public static final boolean DEFAULT_HA_ENABLED
The default value of HA enabled = false- See Also:
- Constant Field Values
-
DEFAULT_PREFER_NATIVE_TRANSPORT
public static final boolean DEFAULT_PREFER_NATIVE_TRANSPORT
The default value for preferring native transport = false- See Also:
- Constant Field Values
-
DEFAULT_WARNING_EXCEPTION_TIME_UNIT
public static final TimeUnit DEFAULT_WARNING_EXCEPTION_TIME_UNIT
The default value of warning exception time unit =TimeUnit.NANOSECONDS
-
DEFAULT_DISABLE_TCCL
public static final boolean DEFAULT_DISABLE_TCCL
The default value of thread context classloader disabling =false- See Also:
- Constant Field Values
-
DEFAULT_USE_DAEMON_THREAD
public static final boolean DEFAULT_USE_DAEMON_THREAD
Set default value to false for aligning with the old behavior By default, Vert.x threads are NOT daemons - we want them to prevent JVM exit so embedded user doesn't have to explicitly prevent JVM from exiting.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
VertxOptions
public VertxOptions()
Default constructor
-
VertxOptions
public VertxOptions(VertxOptions other)
Copy constructor- Parameters:
other- The otherVertxOptionsto copy when creating this
-
VertxOptions
public VertxOptions(JsonObject json)
Create an instance from aJsonObject- Parameters:
json- the JsonObject to create it from
-
-
Method Detail
-
getEventLoopPoolSize
public int getEventLoopPoolSize()
Get the number of event loop threads to be used by the Vert.x instance.- Returns:
- the number of threads
-
setEventLoopPoolSize
public VertxOptions setEventLoopPoolSize(int eventLoopPoolSize)
Set the number of event loop threads to be used by the Vert.x instance.- Parameters:
eventLoopPoolSize- the number of threads- Returns:
- a reference to this, so the API can be used fluently
-
getWorkerPoolSize
public int getWorkerPoolSize()
Get the maximum number of worker threads to be used by the Vert.x instance.Worker threads are used for running blocking code and worker verticles.
- Returns:
- the maximum number of worker threads
-
setWorkerPoolSize
public VertxOptions setWorkerPoolSize(int workerPoolSize)
Set the maximum number of worker threads to be used by the Vert.x instance.- Parameters:
workerPoolSize- the number of threads- Returns:
- a reference to this, so the API can be used fluently
-
getBlockedThreadCheckInterval
public long getBlockedThreadCheckInterval()
Get the value of blocked thread check period, inblockedThreadCheckIntervalUnit.This setting determines how often Vert.x will check whether event loop threads are executing for too long.
The default value of
blockedThreadCheckIntervalUnitisTimeUnit.MILLISECONDS.- Returns:
- the value of blocked thread check period, in
blockedThreadCheckIntervalUnit.
-
setBlockedThreadCheckInterval
public VertxOptions setBlockedThreadCheckInterval(long blockedThreadCheckInterval)
Sets the value of blocked thread check period, inblockedThreadCheckIntervalUnit.The default value of
blockedThreadCheckIntervalUnitisTimeUnit.MILLISECONDS- Parameters:
blockedThreadCheckInterval- the value of blocked thread check period, inblockedThreadCheckIntervalUnit.- Returns:
- a reference to this, so the API can be used fluently
-
getMaxEventLoopExecuteTime
public long getMaxEventLoopExecuteTime()
Get the value of max event loop execute time, inmaxEventLoopExecuteTimeUnit.Vert.x will automatically log a warning if it detects that event loop threads haven't returned within this time.
This can be used to detect where the user is blocking an event loop thread, contrary to the Golden Rule of the holy Event Loop.
The default value of
maxEventLoopExecuteTimeUnitisTimeUnit.NANOSECONDS- Returns:
- the value of max event loop execute time, in
maxEventLoopExecuteTimeUnit.
-
setMaxEventLoopExecuteTime
public VertxOptions setMaxEventLoopExecuteTime(long maxEventLoopExecuteTime)
Sets the value of max event loop execute time, inmaxEventLoopExecuteTimeUnit.The default value of
maxEventLoopExecuteTimeUnitisTimeUnit.NANOSECONDS- Parameters:
maxEventLoopExecuteTime- the value of max event loop execute time, inmaxEventLoopExecuteTimeUnit.- Returns:
- a reference to this, so the API can be used fluently
-
getMaxWorkerExecuteTime
public long getMaxWorkerExecuteTime()
Get the value of max worker execute time, inmaxWorkerExecuteTimeUnit.Vert.x will automatically log a warning if it detects that worker threads haven't returned within this time.
This can be used to detect where the user is blocking a worker thread for too long. Although worker threads can be blocked longer than event loop threads, they shouldn't be blocked for long periods of time.
The default value of
maxWorkerExecuteTimeUnitisTimeUnit.NANOSECONDS- Returns:
- The value of max worker execute time, in
maxWorkerExecuteTimeUnit.
-
setMaxWorkerExecuteTime
public VertxOptions setMaxWorkerExecuteTime(long maxWorkerExecuteTime)
Sets the value of max worker execute time, inmaxWorkerExecuteTimeUnit.The default value of
maxWorkerExecuteTimeUnitisTimeUnit.NANOSECONDS- Parameters:
maxWorkerExecuteTime- the value of max worker execute time, inmaxWorkerExecuteTimeUnit.- Returns:
- a reference to this, so the API can be used fluently
-
getInternalBlockingPoolSize
public int getInternalBlockingPoolSize()
Get the value of internal blocking pool size.Vert.x maintains a pool for internal blocking operations
- Returns:
- the value of internal blocking pool size
-
setInternalBlockingPoolSize
public VertxOptions setInternalBlockingPoolSize(int internalBlockingPoolSize)
Set the value of internal blocking pool size- Parameters:
internalBlockingPoolSize- the maximumn number of threads in the internal blocking pool- Returns:
- a reference to this, so the API can be used fluently
-
isHAEnabled
public boolean isHAEnabled()
Will HA be enabled on the Vert.x instance?- Returns:
- true if HA enabled, false otherwise
-
setHAEnabled
public VertxOptions setHAEnabled(boolean haEnabled)
Set whether HA will be enabled on the Vert.x instance.- Parameters:
haEnabled- true if enabled, false if not.- Returns:
- a reference to this, so the API can be used fluently
-
getQuorumSize
public int getQuorumSize()
Get the quorum size to be used when HA is enabled.- Returns:
- the quorum size
-
setQuorumSize
public VertxOptions setQuorumSize(int quorumSize)
Set the quorum size to be used when HA is enabled.- Parameters:
quorumSize- the quorum size- Returns:
- a reference to this, so the API can be used fluently
-
getHAGroup
public String getHAGroup()
Get the HA group to be used when HA is enabled.- Returns:
- the HA group
-
setHAGroup
public VertxOptions setHAGroup(String haGroup)
Set the HA group to be used when HA is enabled.- Parameters:
haGroup- the HA group to use- Returns:
- a reference to this, so the API can be used fluently
-
getMetricsOptions
public MetricsOptions getMetricsOptions()
- Returns:
- the metrics options
-
getFileSystemOptions
public FileSystemOptions getFileSystemOptions()
- Returns:
- the file system options
-
setMetricsOptions
public VertxOptions setMetricsOptions(MetricsOptions metrics)
Set the metrics options- Parameters:
metrics- the options- Returns:
- a reference to this, so the API can be used fluently
-
setFileSystemOptions
public VertxOptions setFileSystemOptions(FileSystemOptions fileSystemOptions)
Set the file system options- Parameters:
fileSystemOptions- the options- Returns:
- a reference to this, so the API can be used fluently
-
getWarningExceptionTime
public long getWarningExceptionTime()
Get the threshold value above this, the blocked warning contains a stack trace. inwarningExceptionTimeUnit.The default value of
warningExceptionTimeUnitisTimeUnit.NANOSECONDS- Returns:
- the warning exception time threshold
-
setWarningExceptionTime
public VertxOptions setWarningExceptionTime(long warningExceptionTime)
Set the threshold value above this, the blocked warning contains a stack trace. inwarningExceptionTimeUnit. The default value ofwarningExceptionTimeUnitisTimeUnit.NANOSECONDS- Parameters:
warningExceptionTime-- Returns:
- a reference to this, so the API can be used fluently
-
getEventBusOptions
public EventBusOptions getEventBusOptions()
- Returns:
- the event bus option to configure the event bus communication (host, port, ssl...)
-
setEventBusOptions
public VertxOptions setEventBusOptions(EventBusOptions options)
Sets the event bus configuration to configure the host, port, ssl...- Parameters:
options- the event bus options- Returns:
- a reference to this, so the API can be used fluently
-
getAddressResolverOptions
public AddressResolverOptions getAddressResolverOptions()
- Returns:
- the address resolver options to configure resolving DNS servers, cache TTL, etc...
-
setAddressResolverOptions
public VertxOptions setAddressResolverOptions(AddressResolverOptions addressResolverOptions)
Sets the address resolver configuration to configure resolving DNS servers, cache TTL, etc...- Parameters:
addressResolverOptions- the address resolver options- Returns:
- a reference to this, so the API can be used fluently
-
getPreferNativeTransport
public boolean getPreferNativeTransport()
- Returns:
- whether to prefer the native transport to the NIO transport
-
setPreferNativeTransport
public VertxOptions setPreferNativeTransport(boolean preferNativeTransport)
Set whether to prefer the native transport to the NIO transport.- Parameters:
preferNativeTransport-trueto prefer the native transport- Returns:
- a reference to this, so the API can be used fluently
-
getMaxEventLoopExecuteTimeUnit
public TimeUnit getMaxEventLoopExecuteTimeUnit()
- Returns:
- the time unit of
maxEventLoopExecuteTime
-
setMaxEventLoopExecuteTimeUnit
public VertxOptions setMaxEventLoopExecuteTimeUnit(TimeUnit maxEventLoopExecuteTimeUnit)
Set the time unit ofmaxEventLoopExecuteTime.- Parameters:
maxEventLoopExecuteTimeUnit- the time unit ofmaxEventLoopExecuteTime- Returns:
- a reference to this, so the API can be used fluently
-
getMaxWorkerExecuteTimeUnit
public TimeUnit getMaxWorkerExecuteTimeUnit()
- Returns:
- the time unit of
maxWorkerExecuteTime
-
setMaxWorkerExecuteTimeUnit
public VertxOptions setMaxWorkerExecuteTimeUnit(TimeUnit maxWorkerExecuteTimeUnit)
Set the time unit ofmaxWorkerExecuteTime.- Parameters:
maxWorkerExecuteTimeUnit- the time unit ofmaxWorkerExecuteTime- Returns:
- a reference to this, so the API can be used fluently
-
getWarningExceptionTimeUnit
public TimeUnit getWarningExceptionTimeUnit()
- Returns:
- the time unit of
warningExceptionTime
-
setWarningExceptionTimeUnit
public VertxOptions setWarningExceptionTimeUnit(TimeUnit warningExceptionTimeUnit)
Set the time unit ofwarningExceptionTime.- Parameters:
warningExceptionTimeUnit- the time unit ofwarningExceptionTime- Returns:
- a reference to this, so the API can be used fluently
-
getBlockedThreadCheckIntervalUnit
public TimeUnit getBlockedThreadCheckIntervalUnit()
- Returns:
- the time unit of
blockedThreadCheckInterval
-
setBlockedThreadCheckIntervalUnit
public VertxOptions setBlockedThreadCheckIntervalUnit(TimeUnit blockedThreadCheckIntervalUnit)
Set the time unit ofblockedThreadCheckInterval.- Parameters:
blockedThreadCheckIntervalUnit- the time unit ofwarningExceptionTime- Returns:
- a reference to this, so the API can be used fluently
-
getTracingOptions
public TracingOptions getTracingOptions()
If tracing is disabled, the value will benull.- Returns:
- the tracing options
-
setTracingOptions
public VertxOptions setTracingOptions(TracingOptions tracingOptions)
Set the tracing options- Parameters:
tracingOptions- the options- Returns:
- a reference to this, so the API can be used fluently
-
getDisableTCCL
public boolean getDisableTCCL()
-
setDisableTCCL
public VertxOptions setDisableTCCL(boolean disableTCCL)
Configures whether Vert.x sets theContextclassloader as the thread context classloader on actions executed on thatContext. When aContextis created the current thread classloader is captured and associated with this classloader. Likewise when a Verticle is created, the Verticle'sContextclassloader is set to the current thread classloader unless this classloader is overriden byDeploymentOptions.getClassLoader(). This setting overrides the (legacy) system propertyvertx.disableTCCLand provides control at the Vertx instance level.- Parameters:
disableTCCL-trueto disable thread context classloader update by Vertx- Returns:
- a reference to this, so the API can be used fluently
-
getUseDaemonThread
public Boolean getUseDaemonThread()
Returns whether we want to use daemon vertx thread.- Returns:
truemeans daemon,falsemeans not daemon(user),nullmeans do not change the daemon option of the created vertx thread.
-
setUseDaemonThread
public VertxOptions setUseDaemonThread(Boolean daemon)
Mark the vertx thread as daemon thread or user thread. For keeping the old behavior, the default value isfalseinstead ofnull.- Parameters:
daemon-truemeans daemon,falsemeans not daemon(user),nullmeans do not change the daemon option of the created vertx thread.
-
toJson
public JsonObject toJson()
-
-