Java Thread Future callback(final CountDownLatch latch)

Here you can find the source of callback(final CountDownLatch latch)

Description

callback

License

Apache License

Declaration

private static <V> FutureCallback<V> callback(final CountDownLatch latch) 

Method Source Code

//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();
            }
        };
    }
}

Related

  1. cancel(final Future future)
  2. cancel(Future toCancel)
  3. cancel(List> futures)
  4. cancelNullableFutures(boolean mayInterruptIfRunning, Iterable> futures)