Class ListenableFutures


  • public final class ListenableFutures
    extends Object
    More static utility methods pertaining to Guava's ListenableFuture interface.
    Author:
    Michael Vorburger.ch
    See Also:
    Futures
    • Method Detail

      • addErrorLogging

        @Deprecated
        public static <V> void addErrorLogging​(com.google.common.util.concurrent.ListenableFuture<V> future,
                                               org.slf4j.Logger logger,
                                               String message)
        Adds a callback to a ListenableFuture which logs any failures.

        Instead of using this helper, you should consider directly using Futures.addCallback(ListenableFuture, com.google.common.util.concurrent.FutureCallback, java.util.concurrent.Executor) to add a callback which does real error recovery in case of a failure instead of just logging an error, if you can.

      • addErrorLogging

        @Deprecated
        public static <V> void addErrorLogging​(com.google.common.util.concurrent.ListenableFuture<V> future,
                                               org.slf4j.Logger logger,
                                               String format,
                                               Object arg)
        Adds a callback to a ListenableFuture which logs any failures.

        Instead of using this helper, you should consider directly using Futures.addCallback(ListenableFuture, com.google.common.util.concurrent.FutureCallback, java.util.concurrent.Executor) to add a callback which does real error recovery in case of a failure instead of just logging an error, if you can.

      • addErrorLogging

        @Deprecated
        public static <V> void addErrorLogging​(com.google.common.util.concurrent.ListenableFuture<V> future,
                                               org.slf4j.Logger logger,
                                               String format,
                                               Object... arguments)
        Adds a callback to a ListenableFuture which logs any failures.

        Instead of using this helper, you should consider directly using Futures.addCallback(ListenableFuture, com.google.common.util.concurrent.FutureCallback, java.util.concurrent.Executor) to add a callback which does real error recovery in case of a failure instead of just logging an error, if you can.

      • checkedGet

        public static <V,​E extends Exception> V checkedGet​(com.google.common.util.concurrent.ListenableFuture<V> future,
                                                                 Function<? super Exception,​E> mapper)
                                                          throws E extends Exception
        Throws:
        E extends Exception