SHL-16 exit with twice enter
This commit is contained in:
@@ -32,6 +32,7 @@ public class Bootstrap {
|
||||
|
||||
private static Bootstrap bootstrap;
|
||||
private JLineShellComponent shell;
|
||||
private Thread shellThread;
|
||||
private ConfigurableApplicationContext ctx;
|
||||
private static StopWatch sw = new StopWatch("Spring Sehll");
|
||||
|
||||
@@ -84,8 +85,11 @@ public class Bootstrap {
|
||||
}
|
||||
|
||||
|
||||
shellThread = new Thread(shell,"Spring Shell");
|
||||
shellThread.start();
|
||||
shell.start();
|
||||
//TODO use listener and latch..
|
||||
|
||||
//TODO use listener and latch..
|
||||
while(true) {
|
||||
//System.out.println("shell status = " + shell.getShellStatus().getStatus());
|
||||
if (shell.getShellStatus().getStatus().equals(ShellStatus.Status.USER_INPUT)) {
|
||||
@@ -99,6 +103,7 @@ public class Bootstrap {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void createApplicationContext(String applicationContextLocation) {
|
||||
@@ -180,13 +185,19 @@ public class Bootstrap {
|
||||
exitShellRequest = ExitShellRequest.NORMAL_EXIT;
|
||||
}
|
||||
} else {
|
||||
shell.promptLoop();
|
||||
//shell.promptLoop();
|
||||
exitShellRequest = shell.getExitShellRequest();
|
||||
if (exitShellRequest == null) {
|
||||
// shouldn't really happen, but we'll fallback to this anyway
|
||||
exitShellRequest = ExitShellRequest.NORMAL_EXIT;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
shellThread.join();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
ctx.close();
|
||||
sw.stop();
|
||||
|
||||
@@ -157,6 +157,7 @@ public abstract class JLineShell extends AbstractShell implements CommandMarker,
|
||||
}, "Spring Roo JLine Shutdown Hook"));
|
||||
|
||||
// Handle any "execute-then-quit" operation
|
||||
|
||||
String rooArgs = System.getProperty("roo.args");
|
||||
if (rooArgs != null && !"".equals(rooArgs)) {
|
||||
setShellStatus(Status.USER_INPUT);
|
||||
@@ -172,6 +173,7 @@ public abstract class JLineShell extends AbstractShell implements CommandMarker,
|
||||
// Normal RPEL processing
|
||||
promptLoop();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String getStartupNotifications() {
|
||||
@@ -430,11 +432,12 @@ public abstract class JLineShell extends AbstractShell implements CommandMarker,
|
||||
}
|
||||
|
||||
executeCommand(line);
|
||||
//System.out.println("executed command:" + line);
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
throw new IllegalStateException("Shell line reading failure", ioe);
|
||||
}
|
||||
|
||||
System.out.println("shuting down");
|
||||
setShellStatus(Status.SHUTTING_DOWN);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,11 +35,11 @@ public class JLineShellComponent extends JLineShell implements Lifecycle {
|
||||
return parser;
|
||||
}
|
||||
|
||||
|
||||
public void start() {
|
||||
Thread thread = new Thread(this, "Spring Roo JLine Shell");
|
||||
thread.start();
|
||||
running=true;
|
||||
}
|
||||
|
||||
|
||||
public void stop() {
|
||||
closeShell();
|
||||
|
||||
Reference in New Issue
Block a user