Skip to content

Commit

Permalink
Fixed Sinks.one(), also added RetryEmitFailureHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-v committed Apr 12, 2021
1 parent 32aeafb commit c8fa309
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions cluster/src/main/java/io/scalecube/cluster/ClusterImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@ private void initLifecycle() {
start
.asMono()
.then(doStart())
.doOnSuccess(c -> onStart.tryEmitEmpty())
.doOnError(onStart::tryEmitError)
.doOnSuccess(c -> onStart.emitEmpty(RetryEmitFailureHandler.INSTANCE))
.doOnError(th -> onStart.emitError(th, RetryEmitFailureHandler.INSTANCE))
.subscribe(null, th -> LOGGER.error("[{}][doStart] Exception occurred:", localMember, th));

shutdown
.asMono()
.then(doShutdown())
.doFinally(s -> onShutdown.tryEmitEmpty())
.doFinally(s -> onShutdown.emitEmpty(RetryEmitFailureHandler.INSTANCE))
.subscribe(
null,
th ->
Expand Down Expand Up @@ -236,7 +236,7 @@ public ClusterImpl handler(Function<Cluster, ClusterMessageHandler> handler) {
public Mono<Cluster> start() {
return Mono.defer(
() -> {
start.tryEmitEmpty();
start.emitEmpty(RetryEmitFailureHandler.INSTANCE);
return onStart.asMono().thenReturn(this);
});
}
Expand Down Expand Up @@ -489,7 +489,7 @@ public <T> Mono<Void> updateMetadata(T metadata) {

@Override
public void shutdown() {
shutdown.tryEmitEmpty();
shutdown.emitEmpty(RetryEmitFailureHandler.INSTANCE);
}

private Mono<Void> doShutdown() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private void init(DisposableServer server) {
// Setup cleanup
stop.asMono()
.then(doStop())
.doFinally(s -> onStop.tryEmitEmpty())
.doFinally(s -> onStop.emitEmpty(RetryEmitFailureHandler.INSTANCE))
.subscribe(
null, ex -> LOGGER.warn("[{}][doStop] Exception occurred: {}", address, ex.toString()));
}
Expand Down Expand Up @@ -181,7 +181,7 @@ public boolean isStopped() {
public final Mono<Void> stop() {
return Mono.defer(
() -> {
stop.tryEmitEmpty();
stop.emitEmpty(RetryEmitFailureHandler.INSTANCE);
return onStop.asMono();
});
}
Expand Down

0 comments on commit c8fa309

Please sign in to comment.