Issue #1932 Allow yajsw to kill the wrapped process after timeout in debug mode
Change-Id: If638edfbb0111fb7b58901584899a0523142c518 Former-commit-id: a8cbb9fb5341cfcc3af3272ba0700bfc451bc1d2
This commit is contained in:
parent
96877d71ff
commit
4128e76180
7 changed files with 26 additions and 25 deletions
Binary file not shown.
Binary file not shown.
|
@ -32,6 +32,7 @@ import java.util.Enumeration;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -70,6 +71,7 @@ import com.raytheon.uf.edex.esb.camel.spring.EdexModesContainer;
|
|||
* Jul 17, 2012 #0740 djohnson Redo changes since the decomposed repositories lost them.
|
||||
* Oct 19, 2012 #1274 bgonzale Load properties from files in conf
|
||||
* resources directory.
|
||||
* Apr 22, 2013 #1932 djohnson Use countdown latch for a shutdown hook.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -88,13 +90,21 @@ public class Executor {
|
|||
|
||||
private static final String MODES_FILE = "modes.xml";
|
||||
|
||||
private static final CountDownLatch shutdownLatch = new CountDownLatch(1);
|
||||
|
||||
public static void start() throws Exception {
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
shutdownLatch.countDown();
|
||||
}
|
||||
});
|
||||
|
||||
long t0 = System.currentTimeMillis();
|
||||
Thread.currentThread().setName("EDEXMain");
|
||||
System.setProperty("System.status", "Starting");
|
||||
|
||||
final boolean[] shutdown = new boolean[] { false };
|
||||
|
||||
String pluginDirStr = PropertiesFactory.getInstance()
|
||||
.getEnvProperties().getEnvValue("PLUGINDIR");
|
||||
|
||||
|
@ -198,26 +208,8 @@ public class Executor {
|
|||
System.out
|
||||
.println("**************************************************");
|
||||
System.setProperty("System.status", "Operational");
|
||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
|
||||
shutdown[0] = true;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
synchronized (shutdown) {
|
||||
while (!shutdown[0]) {
|
||||
try {
|
||||
shutdown.wait();
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
shutdownLatch.await();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Binary file not shown.
|
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=gradle-0.9.2-bin.zip
|
||||
distributionUrl=http://services.gradle.org/distributions/gradle-0.9.2-bin.zip
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# Uncomment those lines to set JVM options. GRADLE_OPTS and JAVA_OPTS can be used together.
|
||||
# GRADLE_OPTS="$GRADLE_OPTS -Xmx512m"
|
||||
# JAVA_OPTS="$JAVA_OPTS -Xmx512m"
|
||||
JAVA_OPTS="$JAVA_OPTS -Dhttp.pxoyPort=80 -Dhttp.proxyHost=http://proxy.ext.ray.com"
|
||||
JAVA_OPTS="$JAVA_OPTS -Dhttp.proxyPort=80 -Dhttp.proxyHost=proxy.ext.ray.com"
|
||||
|
||||
GRADLE_APP_NAME=Gradle
|
||||
|
||||
|
|
|
@ -424,8 +424,17 @@ public class YajswConfigurationImpl extends CompositeConfiguration implements Ya
|
|||
{
|
||||
if (key.equals("wrapper.startup.timeout"))
|
||||
result = Integer.MAX_VALUE / 1000;
|
||||
else if (key.equals("wrapper.shutdown.timeout"))
|
||||
result = (Integer.MAX_VALUE / 1000);
|
||||
/*
|
||||
* djohnson
|
||||
*
|
||||
* Allow the wrapper to kill the process using the shutdown timeout,
|
||||
* even when in debug mode (old wrapper behavior). The shutdown hook
|
||||
* of the wrapped process cannot and will not be invoked if the
|
||||
* wrapper process is signalled to shutdown prior to the wrapped
|
||||
* application starting.
|
||||
*/
|
||||
// else if (key.equals("wrapper.shutdown.timeout"))
|
||||
// result = (Integer.MAX_VALUE / 1000);
|
||||
else if (key.equals("wrapper.ping.timeout"))
|
||||
result = (Integer.MAX_VALUE / 1000);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue