com.sun.enterprise.admin.cli
Class StartServerHelper

java.lang.Object
  extended by com.sun.enterprise.admin.cli.StartServerHelper

public class StartServerHelper
extends Object

Java does not allow multiple inheritance. Both StartDomainCommand and StartInstanceCommand have common code but they are already in a different hierarchy of classes. The first common baseclass is too far away -- e.g. no "launcher" variable, etc. Instead -- put common code in here and call it as common utilities This class is designed to be thread-safe and IMMUTABLE

Author:
bnevins

Nested Class Summary
private  class StartServerHelper.ParentDeathWaiterPureJava
          bnevins the restart flag is set by the RestartDomain command in the local server.
 
Field Summary
private  List<HostAndPort> addresses
           
private  boolean debug
           
private static boolean DEBUG_MESSAGES_ON
           
private  int debugPort
           
private  GFLauncherInfo info
           
private  boolean isDebugSuspend
           
private  GFLauncher launcher
           
private  Logger logger
           
private  String masterPassword
           
private  File pidFile
           
private  ServerDirs serverDirs
           
private  String serverOrDomainName
           
private static LocalStringsImpl strings
           
private  boolean terse
           
 
Constructor Summary
StartServerHelper(Logger logger0, boolean terse0, ServerDirs serverDirs0, GFLauncher launcher0, String masterPassword0, boolean debug0)
           
 
Method Summary
private  String adminPortInUse()
           
private  String adminPortInUse(List<HostAndPort> adminAddresses)
           
private  boolean checkPorts()
           
private static void debugMessage(String s)
           
private  void deletePidFile()
           
 boolean prepareForLaunch()
          Run a series of commands to prepare for a launch.
 void report()
           
private  void setSecurity()
           
private static boolean timedOut(long startTime)
           
private static boolean timedOut(long startTime, long span)
           
private  void waitForParentDeath(int pid)
           
private  void waitForParentToDie()
          If the parent is a GF server -- then wait for it to die.
 void waitForServer()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

terse

private final boolean terse

launcher

private final GFLauncher launcher

logger

private final Logger logger

pidFile

private final File pidFile

info

private final GFLauncherInfo info

addresses

private final List<HostAndPort> addresses

serverDirs

private final ServerDirs serverDirs

masterPassword

private final String masterPassword

serverOrDomainName

private final String serverOrDomainName

debug

private final boolean debug

debugPort

private final int debugPort

isDebugSuspend

private final boolean isDebugSuspend

DEBUG_MESSAGES_ON

private static final boolean DEBUG_MESSAGES_ON
See Also:
Constant Field Values

strings

private static final LocalStringsImpl strings
Constructor Detail

StartServerHelper

public StartServerHelper(Logger logger0,
                         boolean terse0,
                         ServerDirs serverDirs0,
                         GFLauncher launcher0,
                         String masterPassword0,
                         boolean debug0)
Method Detail

waitForServer

public void waitForServer()
                   throws CommandException
Throws:
CommandException

prepareForLaunch

public boolean prepareForLaunch()
                         throws CommandException
Run a series of commands to prepare for a launch.

Returns:
false if there was a problem.
Throws:
CommandException

report

public void report()

waitForParentToDie

private void waitForParentToDie()
                         throws CommandException
If the parent is a GF server -- then wait for it to die. This is part of the Client-Server Restart Dance! THe dying server called us with the system property AS_RESTART set to its pid

Throws:
CommandException - if we timeout waiting for the parent to die or if the admin ports never free up

checkPorts

private boolean checkPorts()

deletePidFile

private void deletePidFile()

setSecurity

private void setSecurity()

adminPortInUse

private String adminPortInUse()

adminPortInUse

private String adminPortInUse(List<HostAndPort> adminAddresses)

waitForParentDeath

private void waitForParentDeath(int pid)
                         throws CommandException
Throws:
CommandException

timedOut

private static boolean timedOut(long startTime)

timedOut

private static boolean timedOut(long startTime,
                                long span)

debugMessage

private static void debugMessage(String s)


Copyright © 2012 GlassFish Community. All Rights Reserved.