org.infinispan.interceptors.distribution.PrimaryOwnerOnlyCollector Maven / Gradle / Ivy
package org.infinispan.interceptors.distribution;
import java.util.concurrent.CompletableFuture;
/**
* A {@link Collector} implementation that only waits for the primary owner.
*
* @author Pedro Ruivo
* @since 9.0
*/
public class PrimaryOwnerOnlyCollector implements Collector {
private final CompletableFuture future;
public PrimaryOwnerOnlyCollector() {
future = new CompletableFuture<>();
}
public CompletableFuture getFuture() {
return future;
}
@Override
public void primaryException(Throwable throwable) {
future.completeExceptionally(throwable);
}
@Override
public void primaryResult(T result, boolean success) {
future.complete(result);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy