Source:
public void run() { synchronized (BIONetworkLayer.this) { starting = false; running = true; } try { if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.log(Level.FINEST, "[{0}] Reader thread started", stack().name()); } ByteBuffer buffer = acquire(); try { while (getIoHub().isOpen() && in.isOpen() && isRecvOpen()) { try { int read = in.read(buffer); if (read < 0) { onRecvClosed(); return; } } catch (ClosedChannelException e) { onRecvClosed(); return; } catch (IOException e) { if (LOGGER.isLoggable(Level.FINER)) { LogRecord record = new LogRecord(Level.FINER, "[{0}] Unexpected I/O exception"); record.setThrown(e); record.setParameters(new Object[]{stack().name()}); LOGGER.log(record); } onRecvClosed(); return; } catch (RuntimeException e) { if (LOGGER.isLoggable(Level.WARNING)) { LogRecord record = new LogRecord(Level.WARNING, "[{0}] Uncaught {1}"); record.setThrown(e); record.setParameters(new Object[]{stack().name(), e.getClass().getSimpleName()}); } onRecvClosed(); return; } buffer.flip(); if (buffer.hasRemaining() && LOGGER.isLoggable(Level.FINEST)) { LOGGER.log(Level.FINEST, "[{0}] RECV: {1} bytes", new Object[]{stack().name(), buffer.remaining()}); } while (buffer.hasRemaining()) { try { onRead(buffer); } catch (IOException e) { onRecvClosed(); return; } } buffer.clear(); } } finally { release(buffer); } } catch (Throwable e) { if (LOGGER.isLoggable(Level.SEVERE)) { LogRecord record = new LogRecord(Level.SEVERE, "[{0}] Reader thread killed by {1}"); record.setThrown(e); record.setParameters(new Object[]{stack().name(), e.getClass().getSimpleName()}); LOGGER.log(record); } } finally { synchronized (BIONetworkLayer.this) { running = false; } if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.log(Level.FINEST, "[{0}] Reader thread stopped", stack().name()); } } }

Target:
public void run() { synchronized (BIONetworkLayer.this) { starting = false; running = true; } try { if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.log(Level.FINEST, "[{0}] Reader thread started", stack().name()); } ByteBuffer buffer = acquire(); try { while (getIoHub().isOpen() && in.isOpen() && isRecvOpen()) { try { int read = in.read(buffer); if (read < 0) { onRecvClosed(); return; } } catch (ClosedChannelException e) { onRecvClosed(); return; } catch (IOException e) { if (LOGGER.isLoggable(Level.FINER) && !(e instanceof EOFException)) { LogRecord record = new LogRecord(Level.FINER, "[{0}] Unexpected I/O exception"); record.setThrown(e); record.setParameters(new Object[]{stack().name()}); LOGGER.log(record); } onRecvClosed(); return; } catch (RuntimeException e) { if (LOGGER.isLoggable(Level.WARNING)) { LogRecord record = new LogRecord(Level.WARNING, "[{0}] Uncaught {1}"); record.setThrown(e); record.setParameters(new Object[]{stack().name(), e.getClass().getSimpleName()}); } onRecvClosed(); return; } buffer.flip(); if (buffer.hasRemaining() && LOGGER.isLoggable(Level.FINEST)) { LOGGER.log(Level.FINEST, "[{0}] RECV: {1} bytes", new Object[]{stack().name(), buffer.remaining()}); } while (buffer.hasRemaining()) { try { onRead(buffer); } catch (IOException e) { onRecvClosed(); return; } } buffer.clear(); } } finally { release(buffer); } } catch (Throwable e) { if (LOGGER.isLoggable(Level.SEVERE)) { LogRecord record = new LogRecord(Level.SEVERE, "[{0}] Reader thread killed by {1}"); record.setThrown(e); record.setParameters(new Object[]{stack().name(), e.getClass().getSimpleName()}); LOGGER.log(record); } if (e instanceof Error) { throw (Error) e; } } finally { synchronized (BIONetworkLayer.this) { running = false; } if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.log(Level.FINEST, "[{0}] Reader thread stopped", stack().name()); } } }