Update gclc version in secondary pakages

Signed-off-by: Emmanuel Bigeon <emmanuel@bigeon.fr>
This commit is contained in:
2017-11-17 17:46:22 -05:00
parent b80a3fc5b8
commit e5d5edcf63
14 changed files with 691 additions and 571 deletions

View File

@@ -81,12 +81,12 @@ of Emmanuel Bigeon. -->
<dependency>
<groupId>fr.bigeon</groupId>
<artifactId>gclc</artifactId>
<version>1.5.0</version>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>fr.bigeon</groupId>
<artifactId>smu</artifactId>
<version>0.0.5</version>
<version>0.0.7</version>
</dependency>
</dependencies>
<parent>

View File

@@ -47,8 +47,8 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import fr.bigeon.gclc.ConsoleApplication;
import fr.bigeon.gclc.manager.ConsoleManager;
import fr.bigeon.gclc.manager.PipedConsoleManager;
import fr.bigeon.gclc.manager.PipedConsoleInput;
import fr.bigeon.gclc.manager.PipedConsoleOutput;
import fr.bigeon.gclc.manager.ReadingRunnable;
/** This is a socket communicating console consoleManager
@@ -76,17 +76,17 @@ public class SocketConsoleApplicationShell implements Runnable, AutoCloseable {
* @author Emmanuel Bigeon */
private final class OutputForwardRunnable implements Runnable {
/**
*
*
*/
private final PrintWriter writer;
/**
*
*
*/
private final Socket socket;
/** @param writer the writer
* @param socket the socket */
protected OutputForwardRunnable(PrintWriter writer, Socket socket) {
protected OutputForwardRunnable(final PrintWriter writer, final Socket socket) {
this.writer = writer;
this.socket = socket;
}
@@ -96,16 +96,16 @@ public class SocketConsoleApplicationShell implements Runnable, AutoCloseable {
public void run() {
try {
while (!socket.isClosed()) {
while (!socket.isClosed() && !consoleManager.available()) {
while (!socket.isClosed() && !output.available()) {
waitASec();
}
if (socket.isClosed()) {
return;
}
String m = consoleManager.readNextLine();
final String m = output.readNextLine();
writer.println(m);
}
} catch (IOException e) {
} catch (final IOException e) {
LOGGER.log(Level.SEVERE, "Unexpected problem in manager", //$NON-NLS-1$
e);
}
@@ -129,8 +129,6 @@ public class SocketConsoleApplicationShell implements Runnable, AutoCloseable {
/** The running status */
private boolean running;
/** The console manager implementation */
private final PipedConsoleManager consoleManager;
/** The auto close flag. if this is true, every request closes the session
* after its call */
private final boolean autoClose;
@@ -140,25 +138,8 @@ public class SocketConsoleApplicationShell implements Runnable, AutoCloseable {
private final String applicationShutdown;
/** The charset for the communication. */
private final Charset charset;
/** Create a socket application shell which will listen on the given port
* and close session upon the provided string reception by client
*
* @param port the port to listen to
* @param close the session closing command
* @param applicationShutdown the appication shut down command
* @param charset the charset for communication
* @throws IOException if the manager could not be created */
public SocketConsoleApplicationShell(int port, String close,
String applicationShutdown, Charset charset) throws IOException {
this.port = port;
this.close = close;
this.applicationShutdown = applicationShutdown;
this.autoClose = false;
this.charset = charset;
//
consoleManager = new PipedConsoleManager();
}
private final PipedConsoleOutput output;
private final PipedConsoleInput input;
/** Create a socket application shell which will listen on the given port
* and auto close session after one instruction
@@ -169,15 +150,157 @@ public class SocketConsoleApplicationShell implements Runnable, AutoCloseable {
* @param applicationShutdown the appication shut down command
* @param charset the charset for communication
* @throws IOException if the manager could not be created */
public SocketConsoleApplicationShell(int port, boolean autoClose,
String applicationShutdown, Charset charset) throws IOException {
public SocketConsoleApplicationShell(final int port, final boolean autoClose,
final String applicationShutdown, final Charset charset) throws IOException {
this.port = port;
this.autoClose = autoClose;
this.applicationShutdown = applicationShutdown;
this.close = autoClose ? null : "close"; //$NON-NLS-1$
close = autoClose ? null : "close"; //$NON-NLS-1$
this.charset = charset;
//
consoleManager = new PipedConsoleManager();
output = new PipedConsoleOutput();
input = new PipedConsoleInput();
}
/** Create a socket application shell which will listen on the given port
* and close session upon the provided string reception by client
*
* @param port the port to listen to
* @param close the session closing command
* @param applicationShutdown the appication shut down command
* @param charset the charset for communication
* @throws IOException if the manager could not be created */
public SocketConsoleApplicationShell(final int port, final String close,
final String applicationShutdown, final Charset charset) throws IOException {
this.port = port;
this.close = close;
this.applicationShutdown = applicationShutdown;
autoClose = false;
this.charset = charset;
//
output = new PipedConsoleOutput();
input = new PipedConsoleInput();
}
/* (non-Javadoc)
* @see java.lang.AutoCloseable#close() */
@Override
public void close() throws IOException {
input.close();
output.close();
}
/** Close the console manager after writing the application shutdown
* command.
*
* @param appThNext the thread containing the application
* @throws IOException if the typyng or closing failed */
private void closeManager(final Thread appThNext) throws IOException {
input.type(applicationShutdown);
try {
appThNext.join(ONE_TENTH_OF_SECOND);
} catch (final InterruptedException e) {
LOGGER.warning("Application thread was interrupted!"); //$NON-NLS-1$
LOGGER.log(Level.FINE,
"Application thread was interrupted while closing", //$NON-NLS-1$
e);
}
close();
}
/** active communication between server and client
*
* @param socket the socket
* @param writer the writer to the application
* @param in the input from the client
* @throws IOException if the communication failed */
private void communicate(final Socket socket, final PrintWriter writer,
final BufferedReader in) throws IOException {
final OutputForwardRunnable cc = new OutputForwardRunnable(writer, socket);
final Thread th = new Thread(cc, "ClientComm"); //$NON-NLS-1$
th.start();
if (autoClose) {
communicateOnce(in);
} else {
communicateLoop(in);
}
}
/** @param in the input from the client
* @throws IOException if the communication failed */
private void communicateLoop(final BufferedReader in) throws IOException {
final ReadingRunnable reading = new ReadingRunnable(in);
final Thread th = new Thread(reading, "gclcToApp"); //$NON-NLS-1$
th.start();
while (app.isRunning() && communicationContent(reading)) {
// keep on going
}
doEndCommunication(reading);
}
/** @param in the input from the client
* @throws IOException if the communication failed */
private void communicateOnce(final BufferedReader in) throws IOException {
final ReadingRunnable reading = new ReadingRunnable(in);
final Thread th = new Thread(reading, "gclcToApp"); //$NON-NLS-1$
th.start();
communicationContent(reading);
doEndCommunication(reading);
}
/** @param reading the reading
* @return if the communication should be stopped.
* @throws IOException if the reading failed */
private boolean communicationContent(final ReadingRunnable reading) throws IOException {
try {
while (app.isRunning() && !reading.hasMessage()) {
synchronized (this) {
waitASec();
}
}
} catch (final IOException e) {
LOGGER.warning("Client seems dead. Closing communication"); //$NON-NLS-1$
LOGGER.log(Level.FINE, "Wait on message from client failed", e); //$NON-NLS-1$
return false;
}
if (!app.isRunning()) {
return false;
}
final String ln = reading.getMessage();
if (ln.equals(close)) {
return false;
}
// Pass command to application
input.type(ln);
return true;
}
/** @param reading the reading runnable
* @throws IOException if the end of communication failed */
private void doEndCommunication(final ReadingRunnable reading) throws IOException {
reading.setRunning(false);
final Thread wait = output.getWaitForDelivery("Bye."); //$NON-NLS-1$
output.println("Bye."); //$NON-NLS-1$
try {
wait.join();
} catch (final InterruptedException e) {
LOGGER.warning("The Bye wait was interrupted."); //$NON-NLS-1$
LOGGER.log(Level.FINE, "An interruption occured", e); //$NON-NLS-1$
}
}
/**
* @return the input
*/
public PipedConsoleInput getInput() {
return input;
}
/**
* @return the output
*/
public PipedConsoleOutput getOutput() {
return output;
}
/* (non-Javadoc)
@@ -186,7 +309,7 @@ public class SocketConsoleApplicationShell implements Runnable, AutoCloseable {
public void run() {
// Create the server
try (ServerSocket actualServerSocket = new ServerSocket(port)) {
this.serverSocket = actualServerSocket;
serverSocket = actualServerSocket;
running = true;
// Create the streams
runSokectServer();
@@ -200,7 +323,7 @@ public class SocketConsoleApplicationShell implements Runnable, AutoCloseable {
/** @throws IOException if the communication with the client failed */
private void runSokectServer() throws IOException {
final ConsoleRunnable runnable = new ConsoleRunnable(app);
Thread appThNext = new Thread(runnable, "gclc-ctrl"); //$NON-NLS-1$
final Thread appThNext = new Thread(runnable, "gclc-ctrl"); //$NON-NLS-1$
appThNext.start();
while (running) {
LOGGER.info("Waiting client"); //$NON-NLS-1$
@@ -221,15 +344,15 @@ public class SocketConsoleApplicationShell implements Runnable, AutoCloseable {
} else {
LOGGER.info("Reconnect to application"); //$NON-NLS-1$
out.println("Reconnected"); //$NON-NLS-1$
out.println(consoleManager.getPrompt());
out.println(input.getPrompt());
}
communicate(clientSocket, out, in);
} catch (SocketException e) {
} catch (final SocketException e) {
LOGGER.log(Level.INFO, "Socket closed"); //$NON-NLS-1$
LOGGER.log(Level.FINE,
"Socket closed with exception (probably due to server interruption)", //$NON-NLS-1$
e);
} catch (IOException e) {
} catch (final IOException e) {
throw e;
}
LOGGER.info("Closing client"); //$NON-NLS-1$
@@ -237,7 +360,7 @@ public class SocketConsoleApplicationShell implements Runnable, AutoCloseable {
runnable.setRunning(false);
try {
closeManager(appThNext);
} catch (IOException e) {
} catch (final IOException e) {
LOGGER.warning("Unable to close application correctly"); //$NON-NLS-1$
LOGGER.log(Level.FINE, "Application closing caused an exception", //$NON-NLS-1$
e);
@@ -245,128 +368,24 @@ public class SocketConsoleApplicationShell implements Runnable, AutoCloseable {
LOGGER.info("Closing Server"); //$NON-NLS-1$
}
/** Close the console manager after writing the application shutdown
* command.
*
* @param appThNext the thread containing the application
* @throws IOException if the typyng or closing failed */
private void closeManager(Thread appThNext) throws IOException {
consoleManager.type(applicationShutdown);
try {
appThNext.join(ONE_TENTH_OF_SECOND);
} catch (InterruptedException e) {
LOGGER.warning("Application thread was interrupted!"); //$NON-NLS-1$
LOGGER.log(Level.FINE,
"Application thread was interrupted while closing", //$NON-NLS-1$
e);
}
consoleManager.close();
/** @param app the application to set */
public synchronized void setApplication(final ConsoleApplication app) {
this.app = app;
}
/** @param runnable the runnable */
private void startApplication(ConsoleRunnable runnable) {
private void startApplication(final ConsoleRunnable runnable) {
runnable.restart();
synchronized (this) {
try {
wait(ONE_TENTH_OF_SECOND);
} catch (InterruptedException e) {
} catch (final InterruptedException e) {
LOGGER.log(Level.SEVERE, "Interruption in application start", //$NON-NLS-1$
e);
}
}
}
/** active communication between server and client
*
* @param socket the socket
* @param writer the writer to the application
* @param in the input from the client
* @throws IOException if the communication failed */
private void communicate(final Socket socket, final PrintWriter writer,
BufferedReader in) throws IOException {
OutputForwardRunnable cc = new OutputForwardRunnable(writer, socket);
Thread th = new Thread(cc, "ClientComm"); //$NON-NLS-1$
th.start();
if (autoClose) {
communicateOnce(in);
} else {
communicateLoop(in);
}
}
/** @param in the input from the client
* @throws IOException if the communication failed */
private void communicateOnce(BufferedReader in) throws IOException {
ReadingRunnable reading = new ReadingRunnable(in);
Thread th = new Thread(reading, "gclcToApp"); //$NON-NLS-1$
th.start();
communicationContent(reading);
doEndCommunication(reading);
}
/** @param reading the reading runnable
* @throws IOException if the end of communication failed */
private void doEndCommunication(ReadingRunnable reading) throws IOException {
reading.setRunning(false);
Thread wait = consoleManager.getWaitForDelivery("Bye."); //$NON-NLS-1$
consoleManager.println("Bye."); //$NON-NLS-1$
try {
wait.join();
} catch (InterruptedException e) {
LOGGER.warning("The Bye wait was interrupted."); //$NON-NLS-1$
LOGGER.log(Level.FINE, "An interruption occured", e); //$NON-NLS-1$
}
}
/** @param in the input from the client
* @throws IOException if the communication failed */
private void communicateLoop(BufferedReader in) throws IOException {
ReadingRunnable reading = new ReadingRunnable(in);
Thread th = new Thread(reading, "gclcToApp"); //$NON-NLS-1$
th.start();
while (app.isRunning() && communicationContent(reading)) {
// keep on going
}
doEndCommunication(reading);
}
/** @param reading the reading
* @return if the communication should be stopped.
* @throws IOException if the reading failed */
private boolean communicationContent(ReadingRunnable reading) throws IOException {
try {
while (app.isRunning() && !reading.hasMessage()) {
synchronized (this) {
waitASec();
}
}
} catch (IOException e) {
LOGGER.warning("Client seems dead. Closing communication"); //$NON-NLS-1$
LOGGER.log(Level.FINE, "Wait on message from client failed", e); //$NON-NLS-1$
return false;
}
if (!app.isRunning()) {
return false;
}
String ln = reading.getMessage();
if (ln.equals(close)) {
return false;
}
// Pass command to application
consoleManager.type(ln);
return true;
}
/** @return the consoleManager */
public synchronized ConsoleManager getConsoleManager() {
return consoleManager;
}
/** @param app the application to set */
public synchronized void setApplication(ConsoleApplication app) {
this.app = app;
}
/** This method will request the server to stop.
* <p>
* In most cases, this will terminate communication on every client. On some
@@ -375,7 +394,7 @@ public class SocketConsoleApplicationShell implements Runnable, AutoCloseable {
running = false;
try {
serverSocket.close();
} catch (IOException e) {
} catch (final IOException e) {
LOGGER.log(Level.SEVERE, "Exception in closing socket server", e); //$NON-NLS-1$
}
app.exit();
@@ -387,17 +406,10 @@ public class SocketConsoleApplicationShell implements Runnable, AutoCloseable {
synchronized (this) {
wait(ONE_TENTH_OF_SECOND);
}
} catch (InterruptedException e) {
} catch (final InterruptedException e) {
LOGGER.log(Level.SEVERE, "Interrupted wait", //$NON-NLS-1$
e);
return;
}
}
/* (non-Javadoc)
* @see java.lang.AutoCloseable#close() */
@Override
public void close() throws IOException {
consoleManager.close();
}
}

View File

@@ -42,7 +42,7 @@ import java.io.IOException;
import org.junit.Test;
import fr.bigeon.gclc.manager.ConsoleManager;
import fr.bigeon.gclc.manager.ConsoleInput;
/** Test class for {@link ConsoleRunnable}
*
@@ -55,71 +55,25 @@ public class ConsoleRunnableTest {
*
* @author Emmanuel Bigeon */
private static final class ConsoleManagerTestImplementation
implements ConsoleManager {
implements ConsoleInput {
int i = 0;
String[] cmds;
/** @param cmds the commands to run */
public ConsoleManagerTestImplementation(String[] cmds) {
public ConsoleManagerTestImplementation(final String[] cmds) {
super();
this.cmds = cmds;
}
@Override
public void setPrompt(String prompt) {
// do nothing
}
@Override
public String getPrompt() {
// Not used in test
return ""; //$NON-NLS-1$
}
@Override
public String prompt() {
try {
Thread.sleep(1000);
} catch (InterruptedException e) { // NOSONAR
// do nothing
}
i++;
if (i == cmds.length) {
i = 0;
}
return cmds[i];
}
@Override
public String prompt(String message) {
return prompt();
}
@Override
public void println(String message) {
// do nothing
}
@Override
public void println() {
// do nothing
}
@Override
public void print(String text) {
// do nothing
}
@Override
public void close() throws IOException {
// do nothing
}
/* (non-Javadoc)
* @see fr.bigeon.gclc.manager.ConsoleManager#isClosed() */
@Override
public boolean isClosed() {
return i == cmds.length;
public String getPrompt() {
// Not used in test
return ""; //$NON-NLS-1$
}
/* (non-Javadoc)
@@ -129,10 +83,36 @@ public class ConsoleRunnableTest {
//
}
/* (non-Javadoc)
* @see fr.bigeon.gclc.manager.ConsoleManager#isClosed() */
@Override
public boolean isClosed() {
return i == cmds.length;
}
@Override
public String prompt() {
try {
Thread.sleep(1000);
} catch (final InterruptedException e) { // NOSONAR
// do nothing
}
i++;
if (i == cmds.length) {
i = 0;
}
return cmds[i];
}
/* (non-Javadoc)
* @see fr.bigeon.gclc.manager.ConsoleManager#prompt(long) */
@Override
public String prompt(long timeout) throws IOException {
public String prompt(final long timeout) throws IOException {
return prompt();
}
@Override
public String prompt(final String message) {
return prompt();
}
@@ -140,9 +120,14 @@ public class ConsoleRunnableTest {
* @see fr.bigeon.gclc.manager.ConsoleManager#prompt(java.lang.String,
* long) */
@Override
public String prompt(String message, long timeout) throws IOException {
public String prompt(final String message, final long timeout) throws IOException {
return prompt(message);
}
@Override
public void setPrompt(final String prompt) {
// do nothing
}
}
/** Test method for
@@ -156,6 +141,16 @@ public class ConsoleRunnableTest {
}
/** Test method for {@link fr.bigeon.gclc.socket.ConsoleRunnable#stop()}. */
@Test
public void testRun() {
// ConsoleApplication app = new ConsoleTestApplication(
// new ConsoleManagerTestImplementation(
// new String[] {"test", ConsoleTestApplication.EXIT})); //$NON-NLS-1$
// ConsoleRunnable runnable = new ConsoleRunnable(app);
// runnable.run();
}
/** Test method for {@link fr.bigeon.gclc.socket.ConsoleRunnable#run()}. */
@Test
public void testRunFlow() {
@@ -184,14 +179,4 @@ public class ConsoleRunnableTest {
// runnable.stop();
}
/** Test method for {@link fr.bigeon.gclc.socket.ConsoleRunnable#stop()}. */
@Test
public void testRun() {
// ConsoleApplication app = new ConsoleTestApplication(
// new ConsoleManagerTestImplementation(
// new String[] {"test", ConsoleTestApplication.EXIT})); //$NON-NLS-1$
// ConsoleRunnable runnable = new ConsoleRunnable(app);
// runnable.run();
}
}

View File

@@ -42,10 +42,11 @@ import fr.bigeon.gclc.command.ExitCommand;
import fr.bigeon.gclc.command.HelpExecutor;
import fr.bigeon.gclc.exception.CommandRunException;
import fr.bigeon.gclc.exception.InvalidCommandName;
import fr.bigeon.gclc.manager.ConsoleManager;
import fr.bigeon.gclc.manager.ConsoleInput;
import fr.bigeon.gclc.manager.ConsoleOutput;
/** A test-purpose application
*
*
* @author Emmanuel Bigeon */
public class ConsoleTestApplication {
@@ -55,40 +56,59 @@ public class ConsoleTestApplication {
/** @param manager the manager
* @return create the application */
@SuppressWarnings("nls")
public static ConsoleApplication create(final ConsoleManager manager) {
public static ConsoleApplication create(final ConsoleOutput manager,
final ConsoleInput input) {
try {
ConsoleApplication application = new ConsoleApplication(manager,
final ConsoleApplication application = new ConsoleApplication(
manager, input,
"Welcome to the test application. Type help or test.",
"See you");
application.add(new ExitCommand(EXIT, application));
application.add(
new HelpExecutor("help", manager, application.root));
application
.add(new HelpExecutor("help", application.root));
application.add(new Command("test") {
/* (non-Javadoc)
* @see fr.bigeon.gclc.command.ICommand#execute(fr.bigeon.gclc.
* manager.ConsoleOutput, fr.bigeon.gclc.manager.ConsoleInput,
* java.lang.String[]) */
@Override
public void execute(final ConsoleOutput out,
final ConsoleInput in,
final String... args) throws CommandRunException {
try {
manager.println("Test command ran fine");
} catch (final IOException e) {
throw new CommandRunException("manager closed", e,
this);
}
}
@Override
public String tip() {
return "A test command";
}
/* (non-Javadoc)
* @see fr.bigeon.gclc.command.Command#usageDetail()
*/
@Override
public void execute(String... args) throws CommandRunException {
try {
manager.println("Test command ran fine");
} catch (IOException e) {
throw new CommandRunException("manager closed", e,
this);
}
protected String usageDetail() {
// TODO Auto-generated method stub
// return null;
throw new RuntimeException("Not implemented yet");
}
});
application.add(new Command("long") {
/* (non-Javadoc)
* @see fr.bigeon.gclc.command.ICommand#execute(fr.bigeon.gclc.
* manager.ConsoleOutput, fr.bigeon.gclc.manager.ConsoleInput,
* java.lang.String[]) */
@Override
public String tip() {
return "A long run test command";
}
@Override
public void execute(String... args) throws CommandRunException {
public void execute(final ConsoleOutput out,
final ConsoleInput in,
final String... args) throws CommandRunException {
try {
Thread.sleep(2000);
manager.println("Test command ran fine");
@@ -97,6 +117,21 @@ public class ConsoleTestApplication {
this);
}
}
@Override
public String tip() {
return "A long run test command";
}
/* (non-Javadoc)
* @see fr.bigeon.gclc.command.Command#usageDetail()
*/
@Override
protected String usageDetail() {
// TODO Auto-generated method stub
// return null;
throw new RuntimeException("Not implemented yet");
}
});
return application;
} catch (final InvalidCommandName e) {

View File

@@ -40,7 +40,7 @@ import java.nio.charset.Charset;
import fr.bigeon.gclc.ConsoleApplication;
/** A test server
*
*
* @author Emmanuel Bigeon */
@SuppressWarnings({"javadoc", "nls"})
public class TestServer {
@@ -48,14 +48,9 @@ public class TestServer {
private static SocketConsoleApplicationShell SHELL;
private static Thread server;
/** @param args no argument
* @throws IOException if the server starting failed */
public static void main(String... args) throws IOException {
try {
startServer(false).join();
} catch (final InterruptedException e) {
e.printStackTrace();
}
public static void closeServer() {
SHELL.stop();
SHELL = null;
}
public static Thread getServer() throws IOException {
@@ -71,38 +66,43 @@ public class TestServer {
SHELL = new SocketConsoleApplicationShell(3300, "close",
ConsoleTestApplication.EXIT, Charset.forName("UTF-8"));
final ConsoleApplication app = ConsoleTestApplication
.create(SHELL.getConsoleManager());
.create(SHELL.getOutput(), SHELL.getInput());
SHELL.setApplication(app);
}
return SHELL;
}
public static Thread startServer(boolean autoClose) throws IOException {
/** @param args no argument
* @throws IOException if the server starting failed */
public static void main(final String... args) throws IOException {
try {
startServer(false).join();
} catch (final InterruptedException e) {
e.printStackTrace();
}
}
public static Thread startServer(final boolean autoClose) throws IOException {
if (SHELL == null) {
SHELL = new SocketConsoleApplicationShell(3300, autoClose,
ConsoleTestApplication.EXIT, Charset.forName("UTF-8"));
final ConsoleApplication app = ConsoleTestApplication
.create(SHELL.getConsoleManager());
.create(SHELL.getOutput(), SHELL.getInput());
SHELL.setApplication(app);
server = null;
}
return getServer();
}
public static Thread startServer(String closeConnection) throws IOException {
public static Thread startServer(final String closeConnection) throws IOException {
if (SHELL == null) {
SHELL = new SocketConsoleApplicationShell(3300, closeConnection,
ConsoleTestApplication.EXIT, Charset.forName("UTF-8"));
final ConsoleApplication app = ConsoleTestApplication
.create(SHELL.getConsoleManager());
.create(SHELL.getOutput(), SHELL.getInput());
SHELL.setApplication(app);
server = null;
}
return getServer();
}
public static void closeServer() {
SHELL.stop();
SHELL = null;
}
}