public WindowFuture<K,R,P> fail(K key, Throwable t) throws InterruptedException {
        if (t == null) {
            throw new IllegalArgumentException("Null throwables are illegal. Use cancel() instead.");
        }
        
        if (!this.futures.containsKey(key)) {
            return null;
        }

        this.lock.lockInterruptibly();
        try {
            // try to remove future from window
            DefaultWindowFuture<K,R,P> future = this.futures.remove(key);
            if (future == null) {
                return null;
            }
            
            // set failed using helper method (bypasses signalAll and requests.remove(key))
            future.failedHelper(t, System.currentTimeMillis());

            // signal that a future is completed
            this.completedCondition.signalAll();

            return future;
        } finally {
            this.lock.unlock();
        }
    }
public WindowFuture < K , R , P > fail ( K key , Throwable t ) throws InterruptedException { if ( t == null ) { throw new IllegalArgumentException ( "Null throwables are illegal. Use cancel() instead." ) ; } if ( ! this . futures . containsKey ( key ) ) { return null ; } this . lock . lockInterruptibly ( ) ; try { DefaultWindowFuture < K , R , P > future = this . futures . remove ( key ) ; if ( future == null ) { return null ; } future . failedHelper ( t , System . currentTimeMillis ( ) ) ; this . completedCondition . signalAll ( ) ; return future ; } finally { this . lock . unlock ( ) ; } }
Fails (completes) a request by setting the cause of the failure on the associated future.
Any callers/threads waiting for completion will be signaled. Also, since
this frees up a slot in the window, one caller/thread blocked with a
pending offer will be signaled to continue.
@param key The key for the original request
@param t The throwable to set as the failure cause on the associated future.
Null values are not accepted (use cancel()) instead.
@return A future representing the entire operation. Since a cause is
set, the future.isSuccess() method will be false.
@throws InterruptedException Thrown if the calling thread is interrupted
and we're currently waiting to acquire the internal "windowLock".