Here you can find the source of callback(final CountDownLatch latch)
private static <V> FutureCallback<V> callback(final CountDownLatch latch)
//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/*from w ww. j a va 2 s . c o m*/ public void onSuccess(final V result) { latch.countDown(); } @Override public void onFailure(final Throwable t) { latch.countDown(); } }; } }