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 areload
operation and waits thedefault timeout
for the reload to complete.static void
executeReloadAndWaitForCompletion(org.jboss.as.controller.client.ModelControllerClient client, int timeout)
Executes areload
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 areload
operation and waits thedefault timeout
for the reload to complete.static void
executeReloadAndWaitForCompletion(org.jboss.as.controller.client.ModelControllerClient client, org.jboss.dmr.ModelNode reloadOp, int timeout)
Executes areload
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.
-
-
-
Field Detail
-
TIMEOUT
public static final int TIMEOUT
Default time, in ms, to wait for reload to complete.- See Also:
- Constant Field Values
-
-
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 operationreloadOp
- the reload operation to execute
-
executeReloadAndWaitForCompletion
public static void executeReloadAndWaitForCompletion(org.jboss.as.controller.client.ModelControllerClient client)
Executes areload
operation and waits thedefault timeout
for 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 areload
operation and waits thedefault timeout
for the reload to complete.- Parameters:
client
- the client to use for the request. Cannot benull
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 areload
operation and waits a configurable maximum time for the reload to complete.- Parameters:
client
- the client to use for the request. Cannot benull
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 areload
operation and waits a configurable maximum time for the reload to complete.- Parameters:
client
- the client to use for the request. Cannot benull
reloadOp
- 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
-
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
-
-