Package org.jboss.resteasy.utils
Class ServerReload
java.lang.Object
org.jboss.resteasy.utils.ServerReload
Utilities for handling server reloads.
- Author:
- Stuart Douglas, James R. Perkins
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault time, in ms, to wait for reload to complete. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidexecuteReload(org.jboss.as.controller.client.ModelControllerClient client) Reloads the server and returns immediately.static voidexecuteReload(org.jboss.as.controller.client.ModelControllerClient client, org.jboss.dmr.ModelNode reloadOp) Reloads the server and returns immediately.static voidexecuteReloadAndWaitForCompletion(org.jboss.as.controller.client.ModelControllerClient client) Executes areloadoperation and waits thedefault timeoutfor the reload to complete.static voidexecuteReloadAndWaitForCompletion(org.jboss.as.controller.client.ModelControllerClient client, int timeout) Executes areloadoperation and waits a configurable maximum time for the reload to complete.static voidexecuteReloadAndWaitForCompletion(org.jboss.as.controller.client.ModelControllerClient client, String serverConfig) Executes areloadoperation and waits a configurable maximum time for the reload to complete.static voidexecuteReloadAndWaitForCompletion(org.jboss.as.controller.client.ModelControllerClient client, org.jboss.dmr.ModelNode reloadOp) Executes areloadoperation and waits thedefault timeoutfor the reload to complete.static voidexecuteReloadAndWaitForCompletion(org.jboss.as.controller.client.ModelControllerClient client, org.jboss.dmr.ModelNode reloadOp, int timeout) Executes areloadoperation and waits a configurable maximum time for the reload to complete.static StringgetContainerRunningState(org.jboss.as.controller.client.ModelControllerClient client) Returns the current running state,server-state, of the server.static voidreloadIfRequired(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.static AutoCloseabletakeSnapshot(int port) Takes a snapshot of the current state of the server.static AutoCloseabletakeSnapshot(org.jboss.as.controller.client.ModelControllerClient client) Takes a snapshot of the current state of the server.
-
Field Details
-
TIMEOUT
public static final int TIMEOUTDefault time, in ms, to wait for reload to complete.- See Also:
-
-
Constructor Details
-
ServerReload
public ServerReload()
-
-
Method Details
-
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 operationreloadOp- the reload operation to execute
-
executeReloadAndWaitForCompletion
public static void executeReloadAndWaitForCompletion(org.jboss.as.controller.client.ModelControllerClient client) Executes areloadoperation and waits thedefault timeoutfor the reload to complete.- Parameters:
client- the client to use for the request. Cannot benull- 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 areloadoperation and waits thedefault timeoutfor the reload to complete.- Parameters:
client- the client to use for the request. Cannot benullreloadOp- 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 areloadoperation and waits a configurable maximum time for the reload to complete.- Parameters:
client- the client to use for the request. Cannot benulltimeout- 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 areloadoperation and waits a configurable maximum time for the reload to complete.- Parameters:
client- the client to use for the request. Cannot benullreloadOp- the operation used for the reloadtimeout- 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, String serverConfig) Executes areloadoperation and waits a configurable maximum time for the reload to complete.- Parameters:
client- the client to use for the request. Cannot benullserverConfig- the server configuration file- 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 occursException
-
takeSnapshot
Takes a snapshot of the current state of the server.Returns a AutoCloseable that can be used to restore the server state
- Parameters:
port- the port to create the client for- Returns:
- A closeable that can be used to restore the server
-
takeSnapshot
public static AutoCloseable takeSnapshot(org.jboss.as.controller.client.ModelControllerClient client) Takes a snapshot of the current state of the server.Returns a AutoCloseable that can be used to restore the server state
- Parameters:
client- The client- Returns:
- A closeable that can be used to restore the server
-