Java 8 CompletionHandler - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 CompletionHandler class.

This code example shows how to use the following methods:completed, failed
    public final void completed(V result, A attachment)
    { 
        try { 
            _closer.close();
            onSuccess(result, attachment);
            _completionHandler.completed(result, attachment);
        } catch (Throwable t) {
            fail(t, attachment);
        } 
    } 
 
    @Override 
    public final void failed(Throwable exc, A attachment)
    { 
        /* This weird looking code is to fulfill the contract of Closer. 
         * It ensures that suppressed exceptions from the Closeables are 
         * handled correctly. 
         */ 
        try { 
            try { 

4
CodeRank
This code example shows how to use the following methods:failed
 
        public void fail(Throwable t) {
            throwable = t;
            completionLatch.countDown();
            if (handler != null) {
                handler.failed(throwable, attachment);
            } 
        } 
 
        @Override 
        public final boolean cancel(boolean mayInterruptIfRunning) {
            // Could support cancellation by closing the connection 
            return false; 
        } 
 
        @Override 
        public final boolean isCancelled() { 
            // Could support cancellation by closing the connection 
            return false; 
        } 
4
CodeRank
This code example shows how to use the following methods:failed
		} 
 
		@Override 
		public void failed(Throwable exc, Object attachment) {
			SocketImpl.this.writeNext();
			if(this.callback!=null) this.callback.failed(exc, att);
		} 
	} 
} 
3
CodeRank
See Code Examples for Java 8 CompletionHandler Methods: