use of io.atomix.primitive.proxy.PrimitiveProxy in project atomix by atomix.
the class DefaultPrimaryElectionService method stop.
@Override
public CompletableFuture<Void> stop() {
PrimitiveProxy proxy = this.proxy;
if (proxy != null) {
return proxy.close().whenComplete((result, error) -> {
started.set(false);
});
}
started.set(false);
return CompletableFuture.completedFuture(null);
}
use of io.atomix.primitive.proxy.PrimitiveProxy in project atomix by atomix.
the class RecoveringPrimitiveProxy method close.
@Override
public synchronized CompletableFuture<Void> close() {
if (connected) {
connected = false;
if (recoverTask != null) {
recoverTask.cancel();
}
PrimitiveProxy proxy = this.proxy;
if (proxy != null) {
return proxy.close();
} else {
return clientFuture.thenCompose(c -> c.close());
}
}
return CompletableFuture.completedFuture(null);
}
use of io.atomix.primitive.proxy.PrimitiveProxy in project atomix by atomix.
the class RecoveringPrimitiveProxy method removeEventListener.
@Override
public synchronized void removeEventListener(Consumer<PrimitiveEvent> consumer) {
checkOpen();
eventListeners.remove(consumer);
PrimitiveProxy proxy = this.proxy;
if (proxy != null) {
proxy.removeEventListener(consumer);
}
}
use of io.atomix.primitive.proxy.PrimitiveProxy in project atomix by atomix.
the class RecoveringPrimitiveProxy method execute.
@Override
public CompletableFuture<byte[]> execute(PrimitiveOperation operation) {
checkOpen();
PrimitiveProxy proxy = this.proxy;
if (proxy != null) {
return proxy.execute(operation);
} else {
return clientFuture.thenCompose(c -> c.execute(operation));
}
}
use of io.atomix.primitive.proxy.PrimitiveProxy in project atomix by atomix.
the class RecoveringPrimitiveProxy method addEventListener.
@Override
public synchronized void addEventListener(Consumer<PrimitiveEvent> consumer) {
checkOpen();
eventListeners.add(consumer);
PrimitiveProxy proxy = this.proxy;
if (proxy != null) {
proxy.addEventListener(consumer);
}
}
Aggregations