Did first part of error handling

This commit is contained in:
Norbi Peti 2018-08-29 23:21:19 +02:00
parent c83339ce42
commit 2dac8eb9f5
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
2 changed files with 15 additions and 7 deletions

View file

@ -6,11 +6,12 @@
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="ButtonServerRunner" />
<module name="MCServerRunner" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="ButtonServerRunner" target="1.8" />
<module name="MCServerRunner" target="1.8" />
</bytecodeTargetLevel>
</component>
</project>

View file

@ -52,13 +52,20 @@ public class ServerRunner {
public void run() {
try {
String readLine;
while (!stop && (readLine = reader.readLine()) != null) {
if (readLine.equalsIgnoreCase("stop"))
ServerRunner.stop();
serveroutput.println(readLine);
serveroutput.flush();
while (!stop) {
try {
if ((readLine = reader.readLine()) == null)
break;
if (readLine.equalsIgnoreCase("stop"))
ServerRunner.stop();
serveroutput.println(readLine);
serveroutput.flush();
} catch (Exception e) {
e.printStackTrace();
Thread.sleep(100); //Sleep a bit and keep going
}
}
} catch (IOException e) {
} catch (InterruptedException e) {
e.printStackTrace();
}
ServerRunner.stop();