Merge "Issue #1661 - it will no longer be necessary to connect to EDEX before EDEX "completely" starts when running EDEX in debug mode." into omaha_13.3.1
Former-commit-id: af61ff08574c9c32518f02a4629aa2786e609ec2
This commit is contained in:
commit
d282a49b6f
10 changed files with 138 additions and 20 deletions
Binary file not shown.
Binary file not shown.
7
javaUtilities/yajsw/modifiedSource.txt
Normal file
7
javaUtilities/yajsw/modifiedSource.txt
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
yajsw/src/main/java/org/rzo/yajsw/WrapperExe.java
|
||||||
|
yajsw/src/main/java/org/rzo/yajsw/app/WrapperManagerImpl.java
|
||||||
|
yajsw/src/main/java/org/rzo/yajsw/os/posix/PosixProcess.java
|
||||||
|
yajsw/src/main/java/org/rzo/yajsw/os/posix/bsd/AppStarter.java
|
||||||
|
yajsw/src/main/java/org/rzo/yajsw/os/posix/bsd/BSDProcess.java
|
||||||
|
yajsw/src/main/java/org/rzo/yajsw/wrapper/AbstractWrappedProcess.java
|
||||||
|
yajsw/src/main/java/org/rzo/yajsw/wrapper/WrappedJavaProcess.java
|
|
@ -161,7 +161,11 @@ public class WrapperExe
|
||||||
* the arguments
|
* the arguments
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* bkowal
|
||||||
|
* Suppress extraneous output.
|
||||||
|
*/
|
||||||
/*
|
/*
|
||||||
System.out.println("YAJSW: "+YajswVersion.YAJSW_VERSION);
|
System.out.println("YAJSW: "+YajswVersion.YAJSW_VERSION);
|
||||||
System.out.println("OS : "+YajswVersion.OS_VERSION);
|
System.out.println("OS : "+YajswVersion.OS_VERSION);
|
||||||
|
|
|
@ -219,6 +219,10 @@ public class WrapperManagerImpl implements WrapperManager, Constants, WrapperMan
|
||||||
* System.out.flush(); try { Thread.sleep(10000); } catch
|
* System.out.flush(); try { Thread.sleep(10000); } catch
|
||||||
* (InterruptedException e1) { // TODO Auto-generated catch block
|
* (InterruptedException e1) { // TODO Auto-generated catch block
|
||||||
* e1.printStackTrace(); }
|
* e1.printStackTrace(); }
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* bkowal
|
||||||
|
* Suppress extraneous output unless debug is enabled.
|
||||||
*/
|
*/
|
||||||
if (_debug)
|
if (_debug)
|
||||||
{
|
{
|
||||||
|
@ -815,7 +819,11 @@ public class WrapperManagerImpl implements WrapperManager, Constants, WrapperMan
|
||||||
|
|
||||||
if (OperatingSystem.instance().isPosix())
|
if (OperatingSystem.instance().isPosix())
|
||||||
{
|
{
|
||||||
String absPath = result.getAbsolutePath();
|
String absPath = result.getAbsolutePath();
|
||||||
|
/*
|
||||||
|
* bkowal
|
||||||
|
* Suppress extraneous output unless debug is enabled.
|
||||||
|
*/
|
||||||
if (_debug)
|
if (_debug)
|
||||||
{
|
{
|
||||||
System.out.println("createRWfile " + absPath);
|
System.out.println("createRWfile " + absPath);
|
||||||
|
@ -1240,7 +1248,11 @@ public class WrapperManagerImpl implements WrapperManager, Constants, WrapperMan
|
||||||
Message msg = (Message) e.getMessage();
|
Message msg = (Message) e.getMessage();
|
||||||
if (msg.getCode() == Constants.WRAPPER_MSG_STOP)
|
if (msg.getCode() == Constants.WRAPPER_MSG_STOP)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* bkowal
|
||||||
|
* Suppress extraneous output unless debug is enabled.
|
||||||
|
*/
|
||||||
if (_debug)
|
if (_debug)
|
||||||
{
|
{
|
||||||
System.out.println("wrapper manager received stop command");
|
System.out.println("wrapper manager received stop command");
|
||||||
|
|
|
@ -626,6 +626,10 @@ public class PosixProcess extends AbstractProcess
|
||||||
|
|
||||||
public boolean kill(int code)
|
public boolean kill(int code)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* bkowal
|
||||||
|
* Suppress extraneous output unless debug is enabled.
|
||||||
|
*/
|
||||||
if (_logger != null && _debug )
|
if (_logger != null && _debug )
|
||||||
_logger.info("killing " + _pid);
|
_logger.info("killing " + _pid);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
@ -673,7 +677,11 @@ public class PosixProcess extends AbstractProcess
|
||||||
return false;
|
return false;
|
||||||
if (_arrCmd == null)
|
if (_arrCmd == null)
|
||||||
{
|
{
|
||||||
_arrCmd = _cmd.split(" ");
|
_arrCmd = _cmd.split(" ");
|
||||||
|
/*
|
||||||
|
* bkowal
|
||||||
|
* Suppress extraneous output unless debug is enabled.
|
||||||
|
*/
|
||||||
if (_debug)
|
if (_debug)
|
||||||
{
|
{
|
||||||
log("exec: " + _cmd);
|
log("exec: " + _cmd);
|
||||||
|
@ -687,6 +695,10 @@ public class PosixProcess extends AbstractProcess
|
||||||
if (c != null)
|
if (c != null)
|
||||||
cmd += c + " ";
|
cmd += c + " ";
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* bkowal
|
||||||
|
* Suppress extraneous output unless debug is enabled.
|
||||||
|
*/
|
||||||
if (_debug)
|
if (_debug)
|
||||||
{
|
{
|
||||||
log("exec:" + cmd);
|
log("exec:" + cmd);
|
||||||
|
@ -736,7 +748,11 @@ public class PosixProcess extends AbstractProcess
|
||||||
|
|
||||||
// fork a child process
|
// fork a child process
|
||||||
if ((pid = CLibrary.INSTANCE.fork()) == 0)
|
if ((pid = CLibrary.INSTANCE.fork()) == 0)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* bkowal
|
||||||
|
* Suppress extraneous output unless debug is enabled.
|
||||||
|
*/
|
||||||
if (_debug)
|
if (_debug)
|
||||||
{
|
{
|
||||||
System.out.println("fork 0");
|
System.out.println("fork 0");
|
||||||
|
@ -748,7 +764,11 @@ public class PosixProcess extends AbstractProcess
|
||||||
if (getWorkingDir() != null)
|
if (getWorkingDir() != null)
|
||||||
if (CLibrary.INSTANCE.chdir(getWorkingDir()) != 0)
|
if (CLibrary.INSTANCE.chdir(getWorkingDir()) != 0)
|
||||||
log("could not set working dir");
|
log("could not set working dir");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bkowal
|
||||||
|
* Suppress extraneous output unless debug is enabled.
|
||||||
|
*/
|
||||||
if (_debug)
|
if (_debug)
|
||||||
{
|
{
|
||||||
System.out.println("fork 1");
|
System.out.println("fork 1");
|
||||||
|
@ -776,7 +796,11 @@ public class PosixProcess extends AbstractProcess
|
||||||
log("could not set priority ");
|
log("could not set priority ");
|
||||||
}
|
}
|
||||||
if (getUser() != null)
|
if (getUser() != null)
|
||||||
switchUser(getUser(), getPassword());
|
switchUser(getUser(), getPassword());
|
||||||
|
/*
|
||||||
|
* bkowal
|
||||||
|
* Suppress extraneous output unless debug is enabled.
|
||||||
|
*/
|
||||||
if (_debug)
|
if (_debug)
|
||||||
{
|
{
|
||||||
System.out.println("fork 2");
|
System.out.println("fork 2");
|
||||||
|
@ -937,6 +961,10 @@ public class PosixProcess extends AbstractProcess
|
||||||
while ( r != _pid && r != -1 )
|
while ( r != _pid && r != -1 )
|
||||||
{
|
{
|
||||||
r = CLibrary.INSTANCE.waitpid( _pid, status, 0 );
|
r = CLibrary.INSTANCE.waitpid( _pid, status, 0 );
|
||||||
|
/*
|
||||||
|
* bkowal
|
||||||
|
* Suppress extraneous output unless debug is enabled.
|
||||||
|
*/
|
||||||
if ( _logger != null && _debug )
|
if ( _logger != null && _debug )
|
||||||
_logger.info( "waitpid " + r + " " + status.getValue() );
|
_logger.info( "waitpid " + r + " " + status.getValue() );
|
||||||
}
|
}
|
||||||
|
@ -951,6 +979,10 @@ public class PosixProcess extends AbstractProcess
|
||||||
else
|
else
|
||||||
_exitCode = 0;
|
_exitCode = 0;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* bkowal
|
||||||
|
* Suppress extraneous output unless debug is enabled.
|
||||||
|
*/
|
||||||
if ( _logger != null && _debug )
|
if ( _logger != null && _debug )
|
||||||
_logger.info( "exit code posix process: " +status.getValue()+" application: "+ _exitCode );
|
_logger.info( "exit code posix process: " +status.getValue()+" application: "+ _exitCode );
|
||||||
_terminated = true;
|
_terminated = true;
|
||||||
|
@ -958,6 +990,10 @@ public class PosixProcess extends AbstractProcess
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bkowal
|
||||||
|
* Suppress extraneous output unless debug is enabled.
|
||||||
|
*/
|
||||||
if (_logger != null && _debug)
|
if (_logger != null && _debug)
|
||||||
_logger.info("started process " + _pid);
|
_logger.info("started process " + _pid);
|
||||||
return true;
|
return true;
|
||||||
|
@ -996,6 +1032,10 @@ public class PosixProcess extends AbstractProcess
|
||||||
|
|
||||||
public boolean stop(int timeout, int code)
|
public boolean stop(int timeout, int code)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* bkowal
|
||||||
|
* Suppress extraneous output unless debug is enabled.
|
||||||
|
*/
|
||||||
if (_logger != null && _debug )
|
if (_logger != null && _debug )
|
||||||
_logger.info("killing " + _pid);
|
_logger.info("killing " + _pid);
|
||||||
if (!isRunning())
|
if (!isRunning())
|
||||||
|
|
|
@ -33,6 +33,10 @@ public class AppStarter
|
||||||
CLibrary.INSTANCE.umask(0);
|
CLibrary.INSTANCE.umask(0);
|
||||||
CLibrary.INSTANCE.setsid();
|
CLibrary.INSTANCE.setsid();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bkowal
|
||||||
|
* Suppress extraneous output.
|
||||||
|
*/
|
||||||
//System.out.println("calling exec");
|
//System.out.println("calling exec");
|
||||||
// close streams ?
|
// close streams ?
|
||||||
if (!isPipeStreams())
|
if (!isPipeStreams())
|
||||||
|
|
|
@ -142,7 +142,11 @@ public class BSDProcess extends PosixProcess
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
_terminated = true;
|
_terminated = true;
|
||||||
_exitCode = p.exitValue();
|
_exitCode = p.exitValue();
|
||||||
|
/*
|
||||||
|
* bkowal
|
||||||
|
* Suppress extraneous output unless debug is enabled.
|
||||||
|
*/
|
||||||
if (_debug)
|
if (_debug)
|
||||||
{
|
{
|
||||||
System.out.println("exit code bsd process " + _exitCode);
|
System.out.println("exit code bsd process " + _exitCode);
|
||||||
|
@ -207,7 +211,11 @@ public class BSDProcess extends PosixProcess
|
||||||
if (CLibrary.INSTANCE.sched_setaffinity(_pid, 4, affinity) == -1)
|
if (CLibrary.INSTANCE.sched_setaffinity(_pid, 4, affinity) == -1)
|
||||||
System.out.println("error setting affinity");
|
System.out.println("error setting affinity");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bkowal
|
||||||
|
* Suppress extraneous output unless debug is enabled.
|
||||||
|
*/
|
||||||
if (_debug)
|
if (_debug)
|
||||||
{
|
{
|
||||||
System.out.println("started process " + _pid);
|
System.out.println("started process " + _pid);
|
||||||
|
@ -261,6 +269,10 @@ public class BSDProcess extends PosixProcess
|
||||||
else
|
else
|
||||||
jvm = cmd.substring(0, cmd.indexOf(" "));
|
jvm = cmd.substring(0, cmd.indexOf(" "));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bkowal
|
||||||
|
* Always return the AWIPS II Java.
|
||||||
|
*/
|
||||||
return "/awips2/java/bin/java";
|
return "/awips2/java/bin/java";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -183,8 +183,14 @@ public abstract class AbstractWrappedProcess implements WrappedProcess, Constant
|
||||||
AHessianJmxServer _ahessianServer = null;
|
AHessianJmxServer _ahessianServer = null;
|
||||||
boolean _reconnecting = false;
|
boolean _reconnecting = false;
|
||||||
boolean _init = false;
|
boolean _init = false;
|
||||||
|
|
||||||
public static final int INFINITE_PROCESS_LOGGING = -1;
|
/*
|
||||||
|
* bkowal - added constant.
|
||||||
|
*/
|
||||||
|
public static final int INFINITE_PROCESS_LOGGING = -1;
|
||||||
|
/*
|
||||||
|
* bkowal - switched from 40 to infinite constant
|
||||||
|
*/
|
||||||
public static final int MIN_PROCESS_LINES_TO_LOG = INFINITE_PROCESS_LOGGING;
|
public static final int MIN_PROCESS_LINES_TO_LOG = INFINITE_PROCESS_LOGGING;
|
||||||
|
|
||||||
List<Thread> _shutdownHooks = new ArrayList<Thread>();
|
List<Thread> _shutdownHooks = new ArrayList<Thread>();
|
||||||
|
@ -1019,7 +1025,11 @@ public abstract class AbstractWrappedProcess implements WrappedProcess, Constant
|
||||||
{
|
{
|
||||||
_controller.processStarted();
|
_controller.processStarted();
|
||||||
_totalRestartCount++;
|
_totalRestartCount++;
|
||||||
postStart();
|
postStart();
|
||||||
|
/*
|
||||||
|
* bkowal
|
||||||
|
* Suppress extraneous output unless debug is enabled.
|
||||||
|
*/
|
||||||
if (_debug)
|
if (_debug)
|
||||||
{
|
{
|
||||||
getWrapperLogger().info("started process with pid " + _osProcess.getPid());
|
getWrapperLogger().info("started process with pid " + _osProcess.getPid());
|
||||||
|
@ -1918,7 +1928,11 @@ public abstract class AbstractWrappedProcess implements WrappedProcess, Constant
|
||||||
long shutdownWaitTime = _config.getInt("wrapper.shutdown.timeout", Constants.DEFAULT_SHUTDOWN_TIMEOUT) * 1000;
|
long shutdownWaitTime = _config.getInt("wrapper.shutdown.timeout", Constants.DEFAULT_SHUTDOWN_TIMEOUT) * 1000;
|
||||||
shutdownWaitTime += _config.getInt("wrapper.jvm_exit.timeout", Constants.DEFAULT_JVM_EXIT_TIMEOUT) * 1000;
|
shutdownWaitTime += _config.getInt("wrapper.jvm_exit.timeout", Constants.DEFAULT_JVM_EXIT_TIMEOUT) * 1000;
|
||||||
if (shutdownWaitTime > Integer.MAX_VALUE)
|
if (shutdownWaitTime > Integer.MAX_VALUE)
|
||||||
shutdownWaitTime = Integer.MAX_VALUE;
|
shutdownWaitTime = Integer.MAX_VALUE;
|
||||||
|
/*
|
||||||
|
* bkowal
|
||||||
|
* Suppress extraneous output unless debug is enabled.
|
||||||
|
*/
|
||||||
if (_debug)
|
if (_debug)
|
||||||
{
|
{
|
||||||
getWrapperLogger().info(
|
getWrapperLogger().info(
|
||||||
|
@ -2013,7 +2027,11 @@ public abstract class AbstractWrappedProcess implements WrappedProcess, Constant
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
_osProcess.destroy();
|
_osProcess.destroy();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bkowal
|
||||||
|
* Suppress extraneous output unless debug is enabled.
|
||||||
|
*/
|
||||||
if (_debug)
|
if (_debug)
|
||||||
{
|
{
|
||||||
getWrapperLogger().info("process exit code: " + _osProcess.getExitCode());
|
getWrapperLogger().info("process exit code: " + _osProcess.getExitCode());
|
||||||
|
@ -2739,7 +2757,10 @@ public abstract class AbstractWrappedProcess implements WrappedProcess, Constant
|
||||||
{
|
{
|
||||||
_drainBuffer.write(line);
|
_drainBuffer.write(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bkowal - added logic to check for the infinite indicator
|
||||||
|
*/
|
||||||
if (MIN_PROCESS_LINES_TO_LOG == INFINITE_PROCESS_LOGGING ||
|
if (MIN_PROCESS_LINES_TO_LOG == INFINITE_PROCESS_LOGGING ||
|
||||||
k <= MIN_PROCESS_LINES_TO_LOG)
|
k <= MIN_PROCESS_LINES_TO_LOG)
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,7 +50,10 @@ public class WrappedJavaProcess extends AbstractWrappedProcess
|
||||||
private static final String LAST_KEYWORD = "LAST";
|
private static final String LAST_KEYWORD = "LAST";
|
||||||
|
|
||||||
private static final String _PERIOD_SEPARATOR_ = ".";
|
private static final String _PERIOD_SEPARATOR_ = ".";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bkowal - define the parameter order parameter name
|
||||||
|
*/
|
||||||
private static final String ORDER_PATTERN = "wrapper.jvm.parameter.order";
|
private static final String ORDER_PATTERN = "wrapper.jvm.parameter.order";
|
||||||
|
|
||||||
private static final String NUMERIC_ORDER_PATTERN = ORDER_PATTERN
|
private static final String NUMERIC_ORDER_PATTERN = ORDER_PATTERN
|
||||||
|
@ -368,7 +371,10 @@ public class WrappedJavaProcess extends AbstractWrappedProcess
|
||||||
if (port != -1)
|
if (port != -1)
|
||||||
{
|
{
|
||||||
result.add("-Xdebug");
|
result.add("-Xdebug");
|
||||||
result.add("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=" + port);
|
/*
|
||||||
|
* bkowal - no longer suspend execution when debugging
|
||||||
|
*/
|
||||||
|
result.add("-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=" + port);
|
||||||
}
|
}
|
||||||
String preMainScript = _config.getString("wrapper.app.pre_main.script", null);
|
String preMainScript = _config.getString("wrapper.app.pre_main.script", null);
|
||||||
if (preMainScript != null && preMainScript.length() > 0)
|
if (preMainScript != null && preMainScript.length() > 0)
|
||||||
|
@ -396,11 +402,18 @@ public class WrappedJavaProcess extends AbstractWrappedProcess
|
||||||
|
|
||||||
return orderParameters(result, classpath);
|
return orderParameters(result, classpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* List was left as a generic to match the code that would use it.
|
||||||
|
*/
|
||||||
private List orderParameters(List parameters, String classpath)
|
private List orderParameters(List parameters, String classpath)
|
||||||
{
|
{
|
||||||
Map<String, String> orderedParametersMap = new HashMap<String, String>();
|
Map<String, String> orderedParametersMap = new HashMap<String, String>();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bkowal - loop through the parameters and re-arrange the parameters
|
||||||
|
* in the specified order.
|
||||||
|
*/
|
||||||
Iterator<String> paramOrderIterator =
|
Iterator<String> paramOrderIterator =
|
||||||
_config.getKeys("wrapper.jvm.parameter.order");
|
_config.getKeys("wrapper.jvm.parameter.order");
|
||||||
while (paramOrderIterator.hasNext())
|
while (paramOrderIterator.hasNext())
|
||||||
|
@ -588,7 +601,12 @@ public class WrappedJavaProcess extends AbstractWrappedProcess
|
||||||
sb.append(PATHSEP);
|
sb.append(PATHSEP);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bkowal - recursively search the directories specified
|
||||||
|
* using the wrapper.search.java.classpath jvm parameter and add entries
|
||||||
|
* to the classpath.
|
||||||
|
*/
|
||||||
final String[] jarPattern = new String[] { "jar" };
|
final String[] jarPattern = new String[] { "jar" };
|
||||||
List<String> containingDirectories = new ArrayList<String>();
|
List<String> containingDirectories = new ArrayList<String>();
|
||||||
Iterator<String> searchLocationIterator = _config.getKeys("wrapper.search.java.classpath");
|
Iterator<String> searchLocationIterator = _config.getKeys("wrapper.search.java.classpath");
|
||||||
|
|
Loading…
Add table
Reference in a new issue