class Window {

    public WindowFuture<K,R,P> cancel(K key) throws InterruptedException {
        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.cancelHelper(System.currentTimeMillis());

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

            return future;
        } finally {
            this.lock.unlock();
        }
    }

    public  Window(int size);
    public  Window(int size, ScheduledExecutorService executor, long monitorInterval, WindowListener<K,R,P> listener);
    public  Window(int size, ScheduledExecutorService executor, long monitorInterval, WindowListener<K,R,P> listener, String monitorThreadName);

}