Package org.jboss.resteasy.utils

## Class ServerReload

- java.lang.Object
- - org.jboss.resteasy.utils.ServerReload

-     public class ServerReload
      extends Object

  Utilities for handling server reloads.
  Author:
    Stuart Douglas, James R. Perkins

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `TIMEOUT` | Default time, in ms, to wait for reload to complete.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ServerReload()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static void` | `executeReload​(org.jboss.as.controller.client.ModelControllerClient client)` | Reloads the server and returns immediately.
    `static void` | `executeReload​(org.jboss.as.controller.client.ModelControllerClient client, org.jboss.dmr.ModelNode reloadOp)` | Reloads the server and returns immediately.
    `static void` | `executeReloadAndWaitForCompletion​(org.jboss.as.controller.client.ModelControllerClient client)` | Executes a `reload` operation and waits the `default timeout` for the reload to complete.
    `static void` | `executeReloadAndWaitForCompletion​(org.jboss.as.controller.client.ModelControllerClient client, int timeout)` | Executes a `reload` operation and waits a configurable maximum time for the reload to complete.
    `static void` | `executeReloadAndWaitForCompletion​(org.jboss.as.controller.client.ModelControllerClient client, org.jboss.dmr.ModelNode reloadOp)` | Executes a `reload` operation and waits the `default timeout` for the reload to complete.
    `static void` | `executeReloadAndWaitForCompletion​(org.jboss.as.controller.client.ModelControllerClient client, org.jboss.dmr.ModelNode reloadOp, int timeout)` | Executes a `reload` operation and waits a configurable maximum time for the reload to complete.
    `static String` | `getContainerRunningState​(org.jboss.as.controller.client.ModelControllerClient client)` | Returns the current running state, `server-state`, of the server.
    `static void` | `reloadIfRequired​(org.jboss.as.controller.client.ModelControllerClient client)` | Checks if the container status is "reload-required" and if it's the case executes reload and waits for completion.

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

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

- - ### Field Detail

    - #### TIMEOUT

          public static final int TIMEOUT

      Default time, in ms, to wait for reload to complete.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ServerReload

          public ServerReload()

  - ### Method Detail

    - #### executeReload

          public static void executeReload​(org.jboss.as.controller.client.ModelControllerClient client)

      Reloads the server and returns immediately.
      Parameters:
        `client` - the client used to execute the reload operation

    - #### executeReload

          public static void executeReload​(org.jboss.as.controller.client.ModelControllerClient client,
                                           org.jboss.dmr.ModelNode reloadOp)

      Reloads the server and returns immediately.
      Parameters:
        `client` - the client used to execute the reload operation
        `reloadOp` - the reload operation to execute

    - #### executeReloadAndWaitForCompletion

          public static void executeReloadAndWaitForCompletion​(org.jboss.as.controller.client.ModelControllerClient client)

      Executes a `reload` operation and waits the `default timeout` for the reload to complete.
      Parameters:
        `client` - the client to use for the request. Cannot be `null`
      Throws:
        `AssertionError` - if the reload does not complete within the timeout

    - #### executeReloadAndWaitForCompletion

          public static void executeReloadAndWaitForCompletion​(org.jboss.as.controller.client.ModelControllerClient client,
                                                               org.jboss.dmr.ModelNode reloadOp)

      Executes a `reload` operation and waits the `default timeout` for the reload to complete.
      Parameters:
        `client` - the client to use for the request. Cannot be `null`
        `reloadOp` - the operation used for the reload
      Throws:
        `AssertionError` - if the reload does not complete within the timeout

    - #### executeReloadAndWaitForCompletion

          public static void executeReloadAndWaitForCompletion​(org.jboss.as.controller.client.ModelControllerClient client,
                                                               int timeout)

      Executes a `reload` operation and waits a configurable maximum time for the reload to complete.
      Parameters:
        `client` - the client to use for the request. Cannot be `null`
        `timeout` - maximum time to wait for the reload to complete, in milliseconds
      Throws:
        `AssertionError` - if the reload does not complete within the specified timeout

    - #### executeReloadAndWaitForCompletion

          public static void executeReloadAndWaitForCompletion​(org.jboss.as.controller.client.ModelControllerClient client,
                                                               org.jboss.dmr.ModelNode reloadOp,
                                                               int timeout)

      Executes a `reload` operation and waits a configurable maximum time for the reload to complete.
      Parameters:
        `client` - the client to use for the request. Cannot be `null`
        `reloadOp` - the operation used for the reload
        `timeout` - maximum time to wait for the reload to complete, in milliseconds
      Throws:
        `AssertionError` - if the reload does not complete within the specified timeout

    - #### getContainerRunningState

          public static String getContainerRunningState​(org.jboss.as.controller.client.ModelControllerClient client)
                                                 throws IOException

      Returns the current running state, `server-state`, of the server.
      Parameters:
        `client` - the client used to execute the operation
      Returns:
        the running state or "failed" if the operation was unsuccessful
      Throws:
        `IOException` - if a communication error occurs

    - #### reloadIfRequired

          public static void reloadIfRequired​(org.jboss.as.controller.client.ModelControllerClient client)
                                       throws Exception

      Checks if the container status is "reload-required" and if it's the case executes reload and waits for completion.
      Parameters:
        `client` - the client used to execute the operation
      Throws:
        `IOException` - if a communication error occurs
        `Exception`