Skip to content

Commit

Permalink
Cosmetic update of logging
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-v committed Feb 3, 2020
1 parent cfe1294 commit 7935a10
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
9 changes: 4 additions & 5 deletions cluster/src/main/java/io/scalecube/cluster/ClusterImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -488,25 +488,24 @@ public void shutdown() {
private Mono<Void> doShutdown() {
return Mono.defer(
() -> {
LOGGER.info("[{}] Cluster member is shutting down", localMember);
LOGGER.info("[{}][doShutdown] Shutting down", localMember);
return Flux.concatDelayError(
leaveCluster(),
dispose(),
transport.stop(),
Mono.fromRunnable(this::stopJmxMonitor))
.then()
.doFinally(s -> scheduler.dispose())
.doOnSuccess(
avoid -> LOGGER.info("[{}] Cluster member has been shutdown", localMember));
.doOnSuccess(avoid -> LOGGER.info("[{}][doShutdown] Shutdown", localMember));
});
}

private Mono<Void> leaveCluster() {
return membership
.leaveCluster()
.subscribeOn(scheduler)
.doOnSubscribe(s -> LOGGER.info("[{}] Cluster member is leaving a cluster", localMember))
.doOnSuccess(s -> LOGGER.info("[{}] Cluster member has left a cluster", localMember))
.doOnSubscribe(s -> LOGGER.info("[{}] Leaving a cluster", localMember))
.doOnSuccess(s -> LOGGER.info("[{}] Left a cluster", localMember))
.doOnError(
ex ->
LOGGER.warn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ final class ExceptionHandler extends ChannelDuplexHandler {

@Override
public final void exceptionCaught(ChannelHandlerContext ctx, Throwable ex) {
LOGGER.debug("Exception caught for channel {}, cause: {}", ctx.channel(), ex.toString());
LOGGER.debug("Exception caught on channel {}, cause: {}", ctx.channel(), ex.toString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,16 @@ public Mono<Transport> bind0() {
return newTcpServer()
.handle(this::onMessage)
.bind()
.map(server -> new TransportImpl(server, this))
.cast(Transport.class)
.doOnSubscribe(s -> LOGGER.info("Bind cluster transport on port={}", config.port()))
.doOnSuccess(t -> LOGGER.info("[{}] Bound cluster transport", t.address()))
.doOnError(
ex ->
LOGGER.error(
"Failed to bind cluster transport on port={}, cause: {}",
config.port(),
ex.toString()))
.map(server -> new TransportImpl(server, this))
.doOnSuccess(t -> LOGGER.info("[{}] Bound cluster transport", t.address()))
.cast(Transport.class);
ex.toString()));
}

@Override
Expand All @@ -214,13 +215,13 @@ public final Mono<Void> stop() {
private Mono<Void> doStop() {
return Mono.defer(
() -> {
LOGGER.info("[{}] Transport is shutting down", address);
LOGGER.info("[{}][doStop] Stopping", address);
// Complete incoming messages observable
messageSink.complete();
return Flux.concatDelayError(closeServer(), shutdownLoopResources())
.then()
.doFinally(s -> connections.clear())
.doOnSuccess(avoid -> LOGGER.info("[{}] Transport has been shut down", address));
.doOnSuccess(avoid -> LOGGER.info("[{}][doStop] Stopped", address));
});
}

Expand Down

0 comments on commit 7935a10

Please sign in to comment.