Issue #1661 - it will no longer be necessary to connect to EDEX before EDEX "completely" starts when running EDEX in debug mode.

- keep a log of every source file that has been modified for AWIPS II
- identify the modification with a comment

Change-Id: Ic8751b25e69486ab448c85dfc4ade8caaa1c71bc

Former-commit-id: 09263dbf8c [formerly 9e647beded] [formerly 6758a9a50d [formerly 8c8f3437723cf8ad931d3d149d547cac82cca9fb]]
Former-commit-id: 6758a9a50d
Former-commit-id: 4c02dabb3d
This commit is contained in:
Bryan Kowal 2013-03-25 12:01:28 -05:00
parent 2093c6a495
commit 1eba8622d4
10 changed files with 138 additions and 20 deletions

View 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

View file

@ -161,7 +161,11 @@ public class WrapperExe
* the arguments
*/
public static void main(String[] args)
{
{
/*
* bkowal
* Suppress extraneous output.
*/
/*
System.out.println("YAJSW: "+YajswVersion.YAJSW_VERSION);
System.out.println("OS : "+YajswVersion.OS_VERSION);

View file

@ -219,6 +219,10 @@ public class WrapperManagerImpl implements WrapperManager, Constants, WrapperMan
* System.out.flush(); try { Thread.sleep(10000); } catch
* (InterruptedException e1) { // TODO Auto-generated catch block
* e1.printStackTrace(); }
*/
/*
* bkowal
* Suppress extraneous output unless debug is enabled.
*/
if (_debug)
{
@ -815,7 +819,11 @@ public class WrapperManagerImpl implements WrapperManager, Constants, WrapperMan
if (OperatingSystem.instance().isPosix())
{
String absPath = result.getAbsolutePath();
String absPath = result.getAbsolutePath();
/*
* bkowal
* Suppress extraneous output unless debug is enabled.
*/
if (_debug)
{
System.out.println("createRWfile " + absPath);
@ -1240,7 +1248,11 @@ public class WrapperManagerImpl implements WrapperManager, Constants, WrapperMan
Message msg = (Message) e.getMessage();
if (msg.getCode() == Constants.WRAPPER_MSG_STOP)
try
{
{
/*
* bkowal
* Suppress extraneous output unless debug is enabled.
*/
if (_debug)
{
System.out.println("wrapper manager received stop command");

View file

@ -626,6 +626,10 @@ public class PosixProcess extends AbstractProcess
public boolean kill(int code)
{
/*
* bkowal
* Suppress extraneous output unless debug is enabled.
*/
if (_logger != null && _debug )
_logger.info("killing " + _pid);
int count = 0;
@ -673,7 +677,11 @@ public class PosixProcess extends AbstractProcess
return false;
if (_arrCmd == null)
{
_arrCmd = _cmd.split(" ");
_arrCmd = _cmd.split(" ");
/*
* bkowal
* Suppress extraneous output unless debug is enabled.
*/
if (_debug)
{
log("exec: " + _cmd);
@ -687,6 +695,10 @@ public class PosixProcess extends AbstractProcess
if (c != null)
cmd += c + " ";
}
/*
* bkowal
* Suppress extraneous output unless debug is enabled.
*/
if (_debug)
{
log("exec:" + cmd);
@ -736,7 +748,11 @@ public class PosixProcess extends AbstractProcess
// fork a child process
if ((pid = CLibrary.INSTANCE.fork()) == 0)
{
{
/*
* bkowal
* Suppress extraneous output unless debug is enabled.
*/
if (_debug)
{
System.out.println("fork 0");
@ -748,7 +764,11 @@ public class PosixProcess extends AbstractProcess
if (getWorkingDir() != null)
if (CLibrary.INSTANCE.chdir(getWorkingDir()) != 0)
log("could not set working dir");
/*
* bkowal
* Suppress extraneous output unless debug is enabled.
*/
if (_debug)
{
System.out.println("fork 1");
@ -776,7 +796,11 @@ public class PosixProcess extends AbstractProcess
log("could not set priority ");
}
if (getUser() != null)
switchUser(getUser(), getPassword());
switchUser(getUser(), getPassword());
/*
* bkowal
* Suppress extraneous output unless debug is enabled.
*/
if (_debug)
{
System.out.println("fork 2");
@ -937,6 +961,10 @@ public class PosixProcess extends AbstractProcess
while ( r != _pid && r != -1 )
{
r = CLibrary.INSTANCE.waitpid( _pid, status, 0 );
/*
* bkowal
* Suppress extraneous output unless debug is enabled.
*/
if ( _logger != null && _debug )
_logger.info( "waitpid " + r + " " + status.getValue() );
}
@ -951,6 +979,10 @@ public class PosixProcess extends AbstractProcess
else
_exitCode = 0;
}
/*
* bkowal
* Suppress extraneous output unless debug is enabled.
*/
if ( _logger != null && _debug )
_logger.info( "exit code posix process: " +status.getValue()+" application: "+ _exitCode );
_terminated = true;
@ -958,6 +990,10 @@ public class PosixProcess extends AbstractProcess
});
/*
* bkowal
* Suppress extraneous output unless debug is enabled.
*/
if (_logger != null && _debug)
_logger.info("started process " + _pid);
return true;
@ -996,6 +1032,10 @@ public class PosixProcess extends AbstractProcess
public boolean stop(int timeout, int code)
{
/*
* bkowal
* Suppress extraneous output unless debug is enabled.
*/
if (_logger != null && _debug )
_logger.info("killing " + _pid);
if (!isRunning())

View file

@ -33,6 +33,10 @@ public class AppStarter
CLibrary.INSTANCE.umask(0);
CLibrary.INSTANCE.setsid();
/*
* bkowal
* Suppress extraneous output.
*/
//System.out.println("calling exec");
// close streams ?
if (!isPipeStreams())

View file

@ -142,7 +142,11 @@ public class BSDProcess extends PosixProcess
Thread.currentThread().interrupt();
}
_terminated = true;
_exitCode = p.exitValue();
_exitCode = p.exitValue();
/*
* bkowal
* Suppress extraneous output unless debug is enabled.
*/
if (_debug)
{
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)
System.out.println("error setting affinity");
}
/*
* bkowal
* Suppress extraneous output unless debug is enabled.
*/
if (_debug)
{
System.out.println("started process " + _pid);
@ -261,6 +269,10 @@ public class BSDProcess extends PosixProcess
else
jvm = cmd.substring(0, cmd.indexOf(" "));
/*
* bkowal
* Always return the AWIPS II Java.
*/
return "/awips2/java/bin/java";
}

View file

@ -183,8 +183,14 @@ public abstract class AbstractWrappedProcess implements WrappedProcess, Constant
AHessianJmxServer _ahessianServer = null;
boolean _reconnecting = 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;
List<Thread> _shutdownHooks = new ArrayList<Thread>();
@ -1019,7 +1025,11 @@ public abstract class AbstractWrappedProcess implements WrappedProcess, Constant
{
_controller.processStarted();
_totalRestartCount++;
postStart();
postStart();
/*
* bkowal
* Suppress extraneous output unless debug is enabled.
*/
if (_debug)
{
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;
shutdownWaitTime += _config.getInt("wrapper.jvm_exit.timeout", Constants.DEFAULT_JVM_EXIT_TIMEOUT) * 1000;
if (shutdownWaitTime > Integer.MAX_VALUE)
shutdownWaitTime = Integer.MAX_VALUE;
shutdownWaitTime = Integer.MAX_VALUE;
/*
* bkowal
* Suppress extraneous output unless debug is enabled.
*/
if (_debug)
{
getWrapperLogger().info(
@ -2013,7 +2027,11 @@ public abstract class AbstractWrappedProcess implements WrappedProcess, Constant
Thread.currentThread().interrupt();
}
_osProcess.destroy();
/*
* bkowal
* Suppress extraneous output unless debug is enabled.
*/
if (_debug)
{
getWrapperLogger().info("process exit code: " + _osProcess.getExitCode());
@ -2739,7 +2757,10 @@ public abstract class AbstractWrappedProcess implements WrappedProcess, Constant
{
_drainBuffer.write(line);
}
/*
* bkowal - added logic to check for the infinite indicator
*/
if (MIN_PROCESS_LINES_TO_LOG == INFINITE_PROCESS_LOGGING ||
k <= MIN_PROCESS_LINES_TO_LOG)
{

View file

@ -50,7 +50,10 @@ public class WrappedJavaProcess extends AbstractWrappedProcess
private static final String LAST_KEYWORD = "LAST";
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 NUMERIC_ORDER_PATTERN = ORDER_PATTERN
@ -368,7 +371,10 @@ public class WrappedJavaProcess extends AbstractWrappedProcess
if (port != -1)
{
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);
if (preMainScript != null && preMainScript.length() > 0)
@ -396,11 +402,18 @@ public class WrappedJavaProcess extends AbstractWrappedProcess
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)
{
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 =
_config.getKeys("wrapper.jvm.parameter.order");
while (paramOrderIterator.hasNext())
@ -588,7 +601,12 @@ public class WrappedJavaProcess extends AbstractWrappedProcess
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" };
List<String> containingDirectories = new ArrayList<String>();
Iterator<String> searchLocationIterator = _config.getKeys("wrapper.search.java.classpath");