[bs-71] "spring run app.groovy" stalls at end (non-daemon thread)

* Change default so that file is not watched (add --watch to watch it)
* The runner thread is set to daemon mode

[Fixes #48716955]
This commit is contained in:
Dave Syer 2013-04-25 09:06:54 +01:00
parent a91b482849
commit 214b3a28db
3 changed files with 10 additions and 7 deletions

View File

@ -38,7 +38,7 @@ import static java.util.Arrays.asList;
*/
public class RunCommand extends OptionParsingCommand {
private OptionSpec<Void> noWatchOption; // FIXME
private OptionSpec<Void> watchOption;
private OptionSpec<Void> editOption;
@ -70,8 +70,8 @@ public class RunCommand extends OptionParsingCommand {
@Override
protected OptionParser createOptionParser() {
OptionParser parser = new OptionParser();
this.noWatchOption = parser.accepts("no-watch",
"Do not watch the specified file for changes");
this.watchOption = parser
.accepts("watch", "Watch the specified file for changes");
this.editOption = parser.acceptsAll(asList("edit", "e"),
"Open the file with the default system editor");
this.noGuessImportsOption = parser.accepts("no-guess-imports",
@ -127,7 +127,7 @@ public class RunCommand extends OptionParsingCommand {
@Override
public boolean isWatchForFileChanges() {
return !this.options.has(RunCommand.this.noWatchOption);
return this.options.has(RunCommand.this.watchOption);
}
@Override

View File

@ -32,7 +32,8 @@ public class SpringMvcCompilerAutoConfiguration extends CompilerAutoConfiguratio
@Override
public void applyDependencies(DependencyCustomizer dependencies) {
dependencies.ifAnyMissingClasses("org.springframework.web.servlet.mvc.Controller")
dependencies
.ifAnyMissingClasses("org.springframework.web.servlet.mvc.Controller")
.add("org.springframework", "spring-webmvc", "4.0.0.BOOTSTRAP-SNAPSHOT");
dependencies.ifAnyMissingClasses("org.apache.catalina.startup.Tomcat",
@ -42,8 +43,8 @@ public class SpringMvcCompilerAutoConfiguration extends CompilerAutoConfiguratio
// FIXME restore Tomcat when we can get reload to work
// dependencies.ifMissingClasses("org.apache.catalina.startup.Tomcat",
// "org.eclipse.jetty.server.Server")
// .add("org.apache.tomcat.embed", "tomcat-embed-core", "7.0.37")
// .add("org.apache.tomcat.embed", "tomcat-embed-logging-juli", "7.0.37");
// .add("org.apache.tomcat.embed", "tomcat-embed-core", "7.0.39")
// .add("org.apache.tomcat.embed", "tomcat-embed-logging-juli", "7.0.39");
}
@Override

View File

@ -119,6 +119,7 @@ public class BootstrapRunner {
if (classes.length != 0) {
setContextClassLoader(classes[0].getClassLoader());
}
setDaemon(true);
}
@Override
@ -164,6 +165,7 @@ public class BootstrapRunner {
public FileWatchThread() {
this.previous = BootstrapRunner.this.file.lastModified();
setDaemon(false);
}
@Override