Java tutorial
//package com.java2s; //License from project: Apache License import java.util.concurrent.CountDownLatch; import com.google.common.util.concurrent.FutureCallback; public class Main { private static <V> FutureCallback<V> callback(final CountDownLatch latch) { return new FutureCallback<V>() { @Override public void onSuccess(final V result) { latch.countDown(); } @Override public void onFailure(final Throwable t) { latch.countDown(); } }; } }