| 13 | private final AtomicBoolean running = new AtomicBoolean(false); |
| 14 | |
| 15 | public interface ErrorHandler { |
| 16 | |
| 17 | void acceptError(IOException e, AtomicBoolean running); |
| 18 | |
| 19 | void closeError(IOException e); |
| 20 | |
| 21 | @SuppressWarnings({"CallToPrintStackTrace"}) |
| 22 | class SysOut implements ErrorHandler { |
| 23 | public void acceptError(IOException e, AtomicBoolean running) { |
| 24 | if (running.get()) { |
| 25 | e.printStackTrace(); |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | public void closeError(IOException e) { |
| 30 | e.printStackTrace(); |
| 31 | } |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | public interface ClientHandler { |
| 36 | |