Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PAYARA-4027 Add timeout parameter to start-deployment-group command #4212

Merged
merged 2 commits into from Sep 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2017-2018 Payara Foundation and/or its affiliates. All rights reserved.
* Copyright (c) 2017-2019 Payara Foundation and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down Expand Up @@ -134,7 +134,7 @@ public void execute(AdminCommandContext context) {
ParameterMap pm = new ParameterMap();
pm.add("delay", delay);
try {
// Run restart-instance against each instance in the cluster
// Run restart-instance against each instance in the Deployment Group
String commandName = "restart-instance";
clusterHelper.runCommand(commandName, pm, deploymentGroup, context,
verbose, rolling);
Expand All @@ -144,7 +144,7 @@ public void execute(AdminCommandContext context) {
logger.warning(msg);
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setMessage(msg);
}
}
}
}

Expand Down
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2017-2018 Payara Foundation and/or its affiliates. All rights reserved.
* Copyright (c) 2017-2019 Payara Foundation and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down Expand Up @@ -45,6 +45,7 @@
import fish.payara.enterprise.config.serverbeans.DeploymentGroup;
import java.util.logging.Logger;
import javax.inject.Inject;
import javax.validation.constraints.Min;
import org.glassfish.api.ActionReport;
import org.glassfish.api.I18n;
import org.glassfish.api.Param;
Expand All @@ -54,6 +55,7 @@
import org.glassfish.api.admin.CommandLock;
import org.glassfish.api.admin.CommandRunner;
import org.glassfish.api.admin.ExecuteOn;
import org.glassfish.api.admin.ParameterMap;
import org.glassfish.api.admin.Progress;
import org.glassfish.api.admin.RestEndpoint;
import org.glassfish.api.admin.RestEndpoints;
Expand Down Expand Up @@ -99,10 +101,13 @@ public class StartDeploymentGroupCommand implements AdminCommand {
@Param(optional = false, primary = true)
private String deploymentGroup;

@Param(optional = true, defaultValue = "false")
@Param(optional = true, shortName = "v", defaultValue = "false")
private boolean verbose;


@Min(message = "Timeout must be at least 1 second long.", value = 1)
@Param(optional = true, shortName = "t", defaultValue = "120")
private int instanceTimeout;

@Override
public void execute(AdminCommandContext context) {
ActionReport report = context.getActionReport();
Expand All @@ -120,11 +125,15 @@ public void execute(AdminCommandContext context) {
}

ClusterCommandHelper clusterHelper = new ClusterCommandHelper(domain, runner);

try {
// Run start-instance against each instance in the cluster
String commandName = "start-instance";
clusterHelper.runCommand(commandName, null, deploymentGroup, context, verbose);
// Run start-instance with timeout parameter against each instance in the Deployment Group
String commandName = "start-instance";

ParameterMap parameterMap = new ParameterMap();
parameterMap.add("timeout", String.valueOf(instanceTimeout));

clusterHelper.runCommand(commandName, parameterMap, deploymentGroup, context, verbose);
} catch (CommandException e) {
String msg = e.getLocalizedMessage();
logger.warning(msg);
Expand Down