diff --git a/edexOsgi/build.edex/esb/bin/yajsw/wrapper.jar b/edexOsgi/build.edex/esb/bin/yajsw/wrapper.jar index 6b7c007d02..53ea4b5f28 100644 Binary files a/edexOsgi/build.edex/esb/bin/yajsw/wrapper.jar and b/edexOsgi/build.edex/esb/bin/yajsw/wrapper.jar differ diff --git a/edexOsgi/build.edex/esb/bin/yajsw/wrapperApp.jar b/edexOsgi/build.edex/esb/bin/yajsw/wrapperApp.jar index 35a55099c5..6969da7c26 100644 Binary files a/edexOsgi/build.edex/esb/bin/yajsw/wrapperApp.jar and b/edexOsgi/build.edex/esb/bin/yajsw/wrapperApp.jar differ diff --git a/javaUtilities/yajsw/modifiedSource.txt b/javaUtilities/yajsw/modifiedSource.txt new file mode 100644 index 0000000000..20e194de63 --- /dev/null +++ b/javaUtilities/yajsw/modifiedSource.txt @@ -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 diff --git a/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/WrapperExe.java b/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/WrapperExe.java index 69cc30953f..84bf919e09 100644 --- a/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/WrapperExe.java +++ b/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/WrapperExe.java @@ -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); diff --git a/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/app/WrapperManagerImpl.java b/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/app/WrapperManagerImpl.java index 976ce5df58..6f314cc4fe 100644 --- a/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/app/WrapperManagerImpl.java +++ b/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/app/WrapperManagerImpl.java @@ -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"); diff --git a/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/os/posix/PosixProcess.java b/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/os/posix/PosixProcess.java index 1d976635da..e2ab1f1d43 100644 --- a/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/os/posix/PosixProcess.java +++ b/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/os/posix/PosixProcess.java @@ -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()) diff --git a/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/os/posix/bsd/AppStarter.java b/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/os/posix/bsd/AppStarter.java index 657b51894a..971333a38d 100644 --- a/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/os/posix/bsd/AppStarter.java +++ b/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/os/posix/bsd/AppStarter.java @@ -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()) diff --git a/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/os/posix/bsd/BSDProcess.java b/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/os/posix/bsd/BSDProcess.java index 3086285cb4..f93931a0fe 100644 --- a/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/os/posix/bsd/BSDProcess.java +++ b/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/os/posix/bsd/BSDProcess.java @@ -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"; } diff --git a/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/wrapper/AbstractWrappedProcess.java b/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/wrapper/AbstractWrappedProcess.java index caf393d2ba..adce359ea1 100644 --- a/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/wrapper/AbstractWrappedProcess.java +++ b/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/wrapper/AbstractWrappedProcess.java @@ -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 _shutdownHooks = new ArrayList(); @@ -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) { diff --git a/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/wrapper/WrappedJavaProcess.java b/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/wrapper/WrappedJavaProcess.java index 431c1934b1..dbe7472f75 100644 --- a/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/wrapper/WrappedJavaProcess.java +++ b/javaUtilities/yajsw/src/main/java/org/rzo/yajsw/wrapper/WrappedJavaProcess.java @@ -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 orderedParametersMap = new HashMap(); - + + /* + * bkowal - loop through the parameters and re-arrange the parameters + * in the specified order. + */ Iterator 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 containingDirectories = new ArrayList(); Iterator searchLocationIterator = _config.getKeys("wrapper.search.java.classpath");