Skip to content

Commit bbb7c38

Browse files
committed
AS_RESTART renamed to AS_RESTART_PREVIOUS_PID and reviewed processing
Signed-off-by: David Matějček <[email protected]>
1 parent 30a87f1 commit bbb7c38

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/cli/StartServerHelper.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import org.glassfish.main.jdke.i18n.LocalStringsImpl;
4141

4242
import static com.sun.enterprise.admin.cli.CLIConstants.MASTER_PASSWORD;
43-
import static com.sun.enterprise.util.StringUtils.ok;
4443
import static java.lang.System.Logger.Level.DEBUG;
4544
import static java.lang.System.Logger.Level.INFO;
4645
import static java.lang.System.Logger.Level.WARNING;
@@ -148,7 +147,7 @@ public void waitForServerStart() throws CommandException {
148147
serverName, output);
149148
return;
150149
}
151-
if (ok(output)) {
150+
if (output.isEmpty()) {
152151
throw new CommandException(I18N.get("serverDiedOutput", serverName, exitCode, output));
153152
}
154153
throw new CommandException(I18N.get("serverDied", serverName, exitCode));
@@ -190,8 +189,9 @@ public void report() {
190189

191190

192191
/**
193-
* If the parent is a GF server -- then wait for it to die. This is part of the Client-Server Restart Dance! THe dying
194-
* server called us with the system property AS_RESTART set to its pid
192+
* If the parent is a GF server -- then wait for it to die.
193+
* This is part of the Client-Server Restart Dance!
194+
* The dying server called us with the system property AS_RESTART_PREVIOUS_PID set to its pid
195195
*
196196
* @throws CommandException if we timeout waiting for the parent to die or if the admin ports never free up
197197
*/
@@ -211,8 +211,8 @@ private void waitForParentToDie() throws CommandException {
211211

212212

213213
private Integer getParentPid() {
214-
String pid = System.getProperty("AS_RESTART");
215-
if (!ok(pid)) {
214+
String pid = System.getProperty("AS_RESTART_PREVIOUS_PID");
215+
if (pid == null) {
216216
return null;
217217
}
218218
try {

nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/admin/RestartServer.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ public class RestartServer {
5959
private String serverName = "";
6060

6161
private static final LocalStringsImpl strings = new LocalStringsImpl(RestartServer.class);
62-
private static final String AS_RESTART_PID = "-DAS_RESTART=" + ProcessHandle.current().pid();
63-
private static final String[] normalProps = { AS_RESTART_PID };
6462
private static final int RESTART_NORMAL = 10;
6563
private static final int RESTART_DEBUG_ON = 11;
6664
private static final int RESTART_DEBUG_OFF = 12;
@@ -136,8 +134,9 @@ private void init(AdminCommandContext context) {
136134

137135
private void scheduleReincarnation() throws RDCException {
138136
try {
137+
final String[] sysProps = new String[] {"-DAS_RESTART_PREVIOUS_PID=" + ProcessHandle.current().pid()};
139138
Runtime.getRuntime()
140-
.addShutdownHook(new StartServerShutdownHook(modulepath, classpath, normalProps, classname, args));
139+
.addShutdownHook(new StartServerShutdownHook(modulepath, classpath, sysProps, classname, args));
141140
} catch (Exception e) {
142141
throw new RDCException(e);
143142
}

0 commit comments

Comments
 (0)