Package io.vertx.core

## Class DeploymentOptions

- java.lang.Object
- - io.vertx.core.DeploymentOptions

-     public class DeploymentOptions
      extends Object

  Options for configuring a verticle deployment.

  Author:
    Tim Fox

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static boolean` | `DEFAULT_HA` |
    `static int` | `DEFAULT_INSTANCES` |
    `static ThreadingModel` | `DEFAULT_MODE` |
    `static boolean` | `DEFAULT_WORKER` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DeploymentOptions()` | Default constructor
    `DeploymentOptions​(DeploymentOptions other)` | Copy constructor
    `DeploymentOptions​(JsonObject json)` | Constructor for creating a instance from JSON

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `ClassLoader` | `getClassLoader()` |
    `JsonObject` | `getConfig()` | Get the JSON configuration that will be passed to the verticle(s) when deployed.
    `int` | `getInstances()` | Get the number of instances that should be deployed.
    `long` | `getMaxWorkerExecuteTime()` | Get the value of max worker execute time, in `maxWorkerExecuteTimeUnit`.
    `TimeUnit` | `getMaxWorkerExecuteTimeUnit()` | When the verticle does not use a `named worker pool`, this option has no effect.
    `ThreadingModel` | `getThreadingModel()` | Which threading model the verticle(s) should use?
    `String` | `getWorkerPoolName()` |
    `int` | `getWorkerPoolSize()` | Get the maximum number of worker threads to be used by the worker pool when the verticle is deployed with a `setWorkerPoolName(java.lang.String)`.
    `boolean` | `isHa()` | Will the verticle(s) be deployed as HA (highly available) ?
    `DeploymentOptions` | `setClassLoader​(ClassLoader classLoader)` | Set the classloader to use for deploying the Verticle.
    `DeploymentOptions` | `setConfig​(JsonObject config)` | Set the JSON configuration that will be passed to the verticle(s) when it's deployed
    `DeploymentOptions` | `setHa​(boolean ha)` | Set whether the verticle(s) will be deployed as HA.
    `DeploymentOptions` | `setInstances​(int instances)` | Set the number of instances that should be deployed.
    `DeploymentOptions` | `setMaxWorkerExecuteTime​(long maxWorkerExecuteTime)` | Sets the value of max worker execute time, in `maxWorkerExecuteTimeUnit`.
    `DeploymentOptions` | `setMaxWorkerExecuteTimeUnit​(TimeUnit maxWorkerExecuteTimeUnit)` | Set the time unit of `maxWorkerExecuteTime`
    `DeploymentOptions` | `setThreadingModel​(ThreadingModel threadingModel)` | Set the verticle(s) verticle(s) threading model, e.g. a worker or a virtual thread verticle
    `DeploymentOptions` | `setWorkerPoolName​(String workerPoolName)` | Set the worker pool name to use for this verticle.
    `DeploymentOptions` | `setWorkerPoolSize​(int workerPoolSize)` | Set the maximum number of worker threads to be used by the Vert.x instance.
    `JsonObject` | `toJson()` | Convert this to JSON

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_MODE

          public static final ThreadingModel DEFAULT_MODE

    - #### DEFAULT_WORKER

          public static final boolean DEFAULT_WORKER

      See Also:
        Constant Field Values

    - #### DEFAULT_HA

          public static final boolean DEFAULT_HA

      See Also:
        Constant Field Values

    - #### DEFAULT_INSTANCES

          public static final int DEFAULT_INSTANCES

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### DeploymentOptions

          public DeploymentOptions()

      Default constructor

    - #### DeploymentOptions

          public DeploymentOptions​(DeploymentOptions other)

      Copy constructor
      Parameters:
        `other` - the instance to copy

    - #### DeploymentOptions

          public DeploymentOptions​(JsonObject json)

      Constructor for creating a instance from JSON
      Parameters:
        `json` - the JSON

  - ### Method Detail

    - #### getConfig

          public JsonObject getConfig()

      Get the JSON configuration that will be passed to the verticle(s) when deployed.
      Returns:
        the JSON config

    - #### setConfig

          public DeploymentOptions setConfig​(JsonObject config)

      Set the JSON configuration that will be passed to the verticle(s) when it's deployed
      Parameters:
        `config` - the JSON config
      Returns:
        a reference to this, so the API can be used fluently

    - #### getThreadingModel

          public ThreadingModel getThreadingModel()

      Which threading model the verticle(s) should use?
      Returns:
        the verticle threading model

    - #### setThreadingModel

          public DeploymentOptions setThreadingModel​(ThreadingModel threadingModel)

      Set the verticle(s) verticle(s) threading model, e.g. a worker or a virtual thread verticle
      Parameters:
        `threadingModel` - the threading model
      Returns:
        a reference to this, so the API can be used fluently

    - #### isHa

          public boolean isHa()

      Will the verticle(s) be deployed as HA (highly available) ?
      Returns:
        true if HA, false otherwise

    - #### setHa

          public DeploymentOptions setHa​(boolean ha)

      Set whether the verticle(s) will be deployed as HA.
      Parameters:
        `ha` - true if to be deployed as HA, false otherwise
      Returns:
        a reference to this, so the API can be used fluently

    - #### getInstances

          public int getInstances()

      Get the number of instances that should be deployed.
      Returns:
        the number of instances

    - #### setInstances

          public DeploymentOptions setInstances​(int instances)

      Set the number of instances that should be deployed.
      Parameters:
        `instances` - the number of instances
      Returns:
        a reference to this, so the API can be used fluently

    - #### getWorkerPoolName

          public String getWorkerPoolName()

      Returns:
        the worker pool name

    - #### setWorkerPoolName

          public DeploymentOptions setWorkerPoolName​(String workerPoolName)

      Set the worker pool name to use for this verticle. When no name is set, the Vert.x worker pool will be used, when a name is set, the verticle will use a named worker pool.
      Parameters:
        `workerPoolName` - the worker pool name
      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 worker pool when the verticle is deployed with a `setWorkerPoolName(java.lang.String)`.

      Worker threads are used for running blocking code and worker verticles.

      When the verticle does not use a `named worker pool`, this option has no effect.

      Returns:
        the maximum number of worker threads

    - #### setWorkerPoolSize

          public DeploymentOptions setWorkerPoolSize​(int workerPoolSize)

      Set the maximum number of worker threads to be used by the Vert.x instance.

      When the verticle does not use a `named worker pool`, this option has no effect.

      Parameters:
        `workerPoolSize` - the number of threads
      Returns:
        a reference to this, so the API can be used fluently

    - #### getMaxWorkerExecuteTime

          public long getMaxWorkerExecuteTime()

      Get the value of max worker execute time, in `maxWorkerExecuteTimeUnit`.

      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.

      When the verticle does not use a `named worker pool`, this option has no effect.

      Returns:
        The value of max worker execute time, the default value of `setMaxWorkerExecuteTimeUnit(java.util.concurrent.TimeUnit)` `maxWorkerExecuteTimeUnit` is `TimeUnit.NANOSECONDS`

    - #### setMaxWorkerExecuteTime

          public DeploymentOptions setMaxWorkerExecuteTime​(long maxWorkerExecuteTime)

      Sets the value of max worker execute time, in `maxWorkerExecuteTimeUnit`.

      The default value of `maxWorkerExecuteTimeUnit` is `TimeUnit.NANOSECONDS`

      When the verticle does not use a `named worker pool`, this option has no effect.

      Parameters:
        `maxWorkerExecuteTime` - the value of max worker execute time, in in `maxWorkerExecuteTimeUnit`.
      Returns:
        a reference to this, so the API can be used fluently

    - #### getMaxWorkerExecuteTimeUnit

          public TimeUnit getMaxWorkerExecuteTimeUnit()

      When the verticle does not use a `named worker pool`, this option has no effect.
      Returns:
        the time unit of `maxWorkerExecuteTime`

    - #### setMaxWorkerExecuteTimeUnit

          public DeploymentOptions setMaxWorkerExecuteTimeUnit​(TimeUnit maxWorkerExecuteTimeUnit)

      Set the time unit of `maxWorkerExecuteTime`

      When the verticle does not use a `named worker pool`, this option has no effect.

      Parameters:
        `maxWorkerExecuteTimeUnit` - the time unit of `maxWorkerExecuteTime`
      Returns:
        a reference to this, so the API can be used fluently

    - #### getClassLoader

          public ClassLoader getClassLoader()

      Returns:
        the classloader used for deploying the Verticle

    - #### setClassLoader

          public DeploymentOptions setClassLoader​(ClassLoader classLoader)

      Set the classloader to use for deploying the Verticle.

      The `VerticleFactory` will use this classloader for creating the Verticle and the Verticle `Context` will set this classloader as context classloader for the tasks execution on context.

      By default no classloader is required and the deployment will use the current thread context classloader.

      Parameters:
        `classLoader` - the loader to use
      Returns:
        a reference to this, so the API can be used fluently

    - #### toJson

          public JsonObject toJson()

      Convert this to JSON
      Returns:
        the JSON