Permalink
Browse files

fixed run-war exiting when it shouldn't and problems with mvn grails:…

…run-war
  • Loading branch information...
1 parent 62cd51f commit f61ab1378de1b0e8d1d18f4f678e75cef5437e4b @graemerocher graemerocher committed May 18, 2012
@@ -47,6 +47,7 @@ class IsolatedWarTomcatServer extends TomcatServer {
def resultProperty = "tomcat.result"
+ System.setProperty("TomcatKillSwitch.active", "true");
Thread.start("tomcat process runner") {
ant.java(classname: IsolatedTomcat.name, fork: true, failonerror: false, output: outFile, error: errFile, resultproperty: resultProperty) {
@@ -79,6 +80,20 @@ class IsolatedWarTomcatServer extends TomcatServer {
}
Runtime.addShutdownHook { this.stop() }
+ Thread.start {
+ // start a thread to monitor kill if server was killed
+ sleep(10000)
+ while(true) {
+ try {
+ new Socket(host, httpPort)
+ sleep(5000)
+ } catch (e) {
+ println "bad"
+ System.setProperty("TomcatKillSwitch.active", "false");
+ break
+ }
+ }
+ }
def timeoutSecs = getConfigParam('startupTimeoutSecs') ?: DEFAULT_STARTUP_TIMEOUT_SECS
def interval = 500 // half a second
@@ -117,7 +132,10 @@ class IsolatedWarTomcatServer extends TomcatServer {
}
protected Collection<File> findTomcatJars(BuildSettings buildSettings) {
- return buildSettings.buildDependencies.findAll { it.name.contains("tomcat") } + buildSettings.compileDependencies.findAll { it.name.contains("tomcat") } + buildSettings.runtimeDependencies.findAll { it.name.contains("tomcat") }
+ return buildSettings.buildDependencies.findAll { it.name.contains("tomcat") } +
+ buildSettings.compileDependencies.findAll { it.name.contains("tomcat") } +
+ buildSettings.runtimeDependencies.findAll { it.name.contains("tomcat") } +
+ buildSettings.providedDependencies.findAll { it.name.contains("tomcat") }
}
void stop() {

0 comments on commit f61ab13

Please sign in to comment.