Future future = (Future) currentFuture.get(); currentFuture.set(null); return future;
currentFuture = new ThreadLocal();
Future oldFuture = (Future) currentFuture.get(); try { if (oldFuture != null) oldFuture.release(); } catch (Exception e) { // ignore } currentFuture.set(future);