Stop console closing on client dirty disconnection
Signed-off-by: Emmanuel Bigeon <emmanuel@bigeon.fr>
This commit is contained in:
parent
69a8fd2533
commit
0f4fd6109d
@ -41,6 +41,7 @@ import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.InterruptedIOException;
|
||||
import java.io.PrintStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.function.Supplier;
|
||||
@ -119,6 +120,7 @@ public final class PluggableConsoleInput implements ConsoleInput {
|
||||
if (prompting) {
|
||||
// print the hint, to indicate we are waiting for a user input.
|
||||
out.print(hint);
|
||||
out.println();
|
||||
out.flush();
|
||||
}
|
||||
final InputStreamReader streamReader = new InputStreamReader(stream,
|
||||
@ -279,7 +281,13 @@ public final class PluggableConsoleInput implements ConsoleInput {
|
||||
final long connexionTimeout) throws IOException, InterruptedException {
|
||||
synchronized (connexionLock) {
|
||||
if (connected) {
|
||||
return connexion.getNextMessage(messageTimeout);
|
||||
try {
|
||||
return connexion.getNextMessage(messageTimeout);
|
||||
} catch (final InterruptedIOException e) {
|
||||
throw e;
|
||||
} catch (final IOException e) {
|
||||
LOGGER.log(Level.INFO, "Communication was abrubptly interrupted", e);
|
||||
}
|
||||
}
|
||||
connexionLock.wait(connexionTimeout);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user