public void run() { while (!quit) { try { process(parentSession.network.receivePacket()); } catch (UnknowServiceException e) { log.warn("unknown packet: " + e.getPacket().toString()); } catch (Exception e) { // ignore IOExceptions if we're closing the thread. log.warn("quit: " + quit + " " + e.getMessage()); if (quit && e instanceof IOException) { return; } log.error("error on process packet", e); try { parentSession.sendExceptionEvent(e, "Source: InputThread"); } catch (Exception e2) { log.error("error on sendException to the session", e2); } // SocketExceptions? Close the connection! if (e instanceof SocketException) { quit = true; } } } }