org.zalando.riptide.micrometer.CompletableFutures Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of riptide-micrometer Show documentation
Show all versions of riptide-micrometer Show documentation
Client side response routing
package org.zalando.riptide.micrometer;
import org.zalando.fauxpas.ThrowingBiConsumer;
import org.zalando.fauxpas.ThrowingConsumer;
import static java.util.Objects.nonNull;
final class CompletableFutures {
private CompletableFutures() {
// nothing to do
}
static ThrowingBiConsumer onResult(
final ThrowingConsumer consumer) {
return (result, throwable) -> {
if (nonNull(result)) {
consumer.tryAccept(result);
}
};
}
static ThrowingBiConsumer onError(
final ThrowingConsumer consumer) {
return (result, throwable) -> {
if (nonNull(throwable)) {
consumer.tryAccept(throwable);
}
};
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy