public void failed(final IOException exception) { if (exception == null) { return; } if (this.completed) { return; } this.completed = true; final SelectionKey key = this.key; if (key != null) { key.cancel(); final Channel channel = key.channel(); try { channel.close(); } catch (final IOException ignore) {} } synchronized (this) { this.exception = exception; if (this.callback != null) { this.callback.failed(this); } notifyAll(); } }
public void failed(final IOException exception) { if (exception == null) { return; } if (this.completed) { return; } this.completed = true; final SelectionKey key = this.key; if (key != null) { key.cancel(); final Channel channel = key.channel(); try { channel.close(); } catch (final IOException ignore) {} } synchronized (this) { this.exception = exception; if (this.callback != null) { this.callback.failed(this); } notifyAll(); } }