Class ClusterCommandHelper
- java.lang.Object
-
- com.sun.enterprise.v3.admin.cluster.ClusterCommandHelper
-
public class ClusterCommandHelper extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ClusterCommandHelper.ReportResult
-
Constructor Summary
Constructors Constructor Description ClusterCommandHelper(Domain domain, CommandRunner runner)
Construct a ClusterCommandHelper
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Server>
optimizeServerListOrder(List<Server> original)
Optimize the order of the list of servers.ActionReport
runCommand(String command, ParameterMap map, String targetName, AdminCommandContext context, boolean verbose)
Loop through all instances in a cluster and execute a command for each one.ActionReport
runCommand(String command, ParameterMap map, String targetName, AdminCommandContext context, boolean verbose, boolean rolling)
Loop through all instances in a cluster and execute a command for each one.void
setAdminTimeout(long adminTimeout)
Set the timeout for ClusterCommandHelper
-
-
-
Constructor Detail
-
ClusterCommandHelper
public ClusterCommandHelper(Domain domain, CommandRunner runner)
Construct a ClusterCommandHelper- Parameters:
domain
- The Domain we are running inrunner
- A CommandRunner to use for running commands
-
-
Method Detail
-
runCommand
public ActionReport runCommand(String command, ParameterMap map, String targetName, AdminCommandContext context, boolean verbose) throws CommandException
Loop through all instances in a cluster and execute a command for each one.- Parameters:
command
- The string of the command to run. The instance name will be used as the operand for the command.map
- A map of parameters to use for the command. May be null if no parameters. When the command is executed for a server instance, the instance name is set as the DEFAULT parameter (operand)targetName
- The name of the cluster or deployment group containing the instances to run the command against.context
- The AdminCommandContext to use when executing the command.verbose
- true for more verbose output- Returns:
- An ActionReport containing the results
- Throws:
CommandException
-
runCommand
public ActionReport runCommand(String command, ParameterMap map, String targetName, AdminCommandContext context, boolean verbose, boolean rolling) throws CommandException
Loop through all instances in a cluster and execute a command for each one.- Parameters:
command
- The string of the command to run. The instance name will be used as the operand for the command.map
- A map of parameters to use for the command. May be null if no parameters. When the command is executed for a server instance, the instance name is set as the DEFAULT parameter (operand)targetName
- The name of the cluster or deployment group containing the instances to run the command against.context
- The AdminCommandContext to use when executing the command.verbose
- true for more verbose outputrolling
- Whether calls should be serialized to help with rolling restarts- Returns:
- An ActionReport containing the results
- Throws:
CommandException
-
optimizeServerListOrder
public List<Server> optimizeServerListOrder(List<Server> original)
Optimize the order of the list of servers. Basically we want the server list to be ordered such that we rotate over the nodes. For example we want: n1, n2, n3, n1, n2, n3 not: n1, n1, n2, n2, n3, n3. This is to spread the load of operations across nodes.- Parameters:
original
- a list of servers- Returns:
- a list of servers with a more optimal order
-
setAdminTimeout
public void setAdminTimeout(long adminTimeout)
Set the timeout for ClusterCommandHelper- Parameters:
adminTimeout
- in milliseconds
-
-