List of usage examples for java.util.concurrent CancellationException getCause
public synchronized Throwable getCause()
From source file:org.punksearch.util.RenewableMemoizer.java
public V compute(final A arg) throws InterruptedException { __log.debug("Compute: " + arg); while (true) { Future<V> f = cache.get(arg); if (f == null) { FutureTask<V> ft = makeFutureTask(arg); f = cache.putIfAbsent(arg, ft); if (f == null) { f = ft;//from ww w. j a v a 2 s. co m ft.run(); } } else { assert timestamps.get(arg) != null; // once put to timestamps value is never removed from it if (timestamps.get(arg) + timeout < System.currentTimeMillis()) { __log.debug("Item expired, removing from cache: " + arg); cache.remove(arg, f); continue; } } try { return f.get(); } catch (CancellationException e) { cache.remove(arg, f); } catch (ExecutionException e) { throw LaunderThrowable.launderThrowable(e.getCause()); } } }