Java Code Examples for java.nio.channels.CompletionHandler#failed()
The following examples show how to use
java.nio.channels.CompletionHandler#failed() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TlsAsynchronousSocketChannel.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Main entry point from caller. */ @Override public <A> void read(ByteBuffer dest, long timeout, TimeUnit unit, A attachment, CompletionHandler<Integer, ? super A> hdlr) { try { if (this.handler != null) { hdlr.completed(0, null); } this.handler = hdlr; this.dst = dest; if (this.clearTextBuffer.hasRemaining()) { // copy any remaining data directly to client dispatchData(); } else if (this.cipherTextBuffer.hasRemaining()) { // otherwise, decrypt ciphertext data remaining from last time decryptAndDispatch(); } else { // otherwise, issue a new read request this.cipherTextBuffer.clear(); this.channel.read(this.cipherTextBuffer, null, this); } } catch (Throwable ex) { hdlr.failed(ex, null); } }
Example 2
Source File: TlsAsynchronousSocketChannel.java From FoxTelem with GNU General Public License v3.0 | 6 votes |
/** * Main entry point from caller. */ @Override public <A> void read(ByteBuffer dest, long timeout, TimeUnit unit, A attachment, CompletionHandler<Integer, ? super A> hdlr) { try { if (this.handler != null) { hdlr.completed(0, null); } this.handler = hdlr; this.dst = dest; if (this.clearTextBuffer.hasRemaining()) { // copy any remaining data directly to client dispatchData(); } else if (this.cipherTextBuffer.hasRemaining()) { // otherwise, decrypt ciphertext data remaining from last time decryptAndDispatch(); } else { // otherwise, issue a new read request this.cipherTextBuffer.clear(); this.channel.read(this.cipherTextBuffer, null, this); } } catch (Throwable ex) { hdlr.failed(ex, null); } }
Example 3
Source File: SyncMessageSender.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
public void send(XMessage message, CompletionHandler<Long, Void> callback) { synchronized (this.waitingAsyncOperationMonitor) { MessageLite msg = message.getMessage(); try { send(message); long result = 4 + 1 + msg.getSerializedSize(); callback.completed(result, null); } catch (Throwable t) { callback.failed(t, null); } } }
Example 4
Source File: TlsAsynchronousSocketChannel.java From lams with GNU General Public License v2.0 | 4 votes |
public void failed(Throwable exc, Void attachment) { CompletionHandler<Integer, ?> h = this.handler; this.handler = null; h.failed(exc, null); }
Example 5
Source File: TlsAsynchronousSocketChannel.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public <A> void read(ByteBuffer[] dsts, int offset, int length, long timeout, TimeUnit unit, A attachment, CompletionHandler<Long, ? super A> hdlr) { hdlr.failed(new UnsupportedOperationException(), null); }
Example 6
Source File: TlsAsynchronousSocketChannel.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public <A> void write(ByteBuffer src, long timeout, TimeUnit unit, A attachment, CompletionHandler<Integer, ? super A> hdlr) { hdlr.failed(new UnsupportedOperationException(), null); }
Example 7
Source File: TlsAsynchronousSocketChannel.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public <A> void connect(SocketAddress remote, A attachment, CompletionHandler<Void, ? super A> hdlr) { hdlr.failed(new UnsupportedOperationException(), null); }
Example 8
Source File: TlsAsynchronousSocketChannel.java From FoxTelem with GNU General Public License v3.0 | 4 votes |
public void failed(Throwable exc, Void attachment) { CompletionHandler<Integer, ?> h = this.handler; this.handler = null; h.failed(exc, null); }
Example 9
Source File: TlsAsynchronousSocketChannel.java From FoxTelem with GNU General Public License v3.0 | 4 votes |
@Override public <A> void read(ByteBuffer[] dsts, int offset, int length, long timeout, TimeUnit unit, A attachment, CompletionHandler<Long, ? super A> hdlr) { hdlr.failed(new UnsupportedOperationException(), null); }
Example 10
Source File: TlsAsynchronousSocketChannel.java From FoxTelem with GNU General Public License v3.0 | 4 votes |
@Override public <A> void write(ByteBuffer src, long timeout, TimeUnit unit, A attachment, CompletionHandler<Integer, ? super A> hdlr) { hdlr.failed(new UnsupportedOperationException(), null); }
Example 11
Source File: TlsAsynchronousSocketChannel.java From FoxTelem with GNU General Public License v3.0 | 4 votes |
@Override public <A> void connect(SocketAddress remote, A attachment, CompletionHandler<Void, ? super A> hdlr) { hdlr.failed(new UnsupportedOperationException(), null); }