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

View File

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

View File

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