All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jashmore.sqs.util.concurrent.CompletableFutureUtils Maven / Gradle / Ivy

Go to download

Utility methods for dealing with basic functionality for this library, split out so so it can be consumed by other extensions

There is a newer version: 6.0.0
Show newest version
package com.jashmore.sqs.util.concurrent;

import lombok.experimental.UtilityClass;

import java.util.concurrent.CompletableFuture;

@UtilityClass
public class CompletableFutureUtils {
    /**
     * Creates a new {@link CompletableFuture} that is completed exceptionally with the provided {@link Throwable}.
     *
     * @param throwable the throwable to complete the {@link CompletableFuture} with
     * @param  the type that the future is returning
     * @return a future that is completed exceptionally
     */
    public static  CompletableFuture completedExceptionally(final Throwable throwable) {
        final CompletableFuture future = new CompletableFuture<>();
        future.completeExceptionally(throwable);
        return future;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy