Skip to content

Commit d683060

Browse files
committed
Added Hooks.onErrorDropped()
1 parent 05ff22f commit d683060

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

services-transport-parent/services-transport-rsocket/src/main/java/io/scalecube/services/transport/rsocket/RSocketServiceTransport.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,30 @@
1818
import java.util.StringJoiner;
1919
import java.util.concurrent.ThreadFactory;
2020
import java.util.function.Function;
21+
import org.slf4j.Logger;
22+
import org.slf4j.LoggerFactory;
2123
import reactor.core.publisher.Flux;
24+
import reactor.core.publisher.Hooks;
2225
import reactor.core.publisher.Mono;
2326
import reactor.netty.FutureMono;
27+
import reactor.netty.channel.AbortedException;
2428
import reactor.netty.resources.LoopResources;
2529

2630
public class RSocketServiceTransport implements ServiceTransport {
2731

32+
public static final Logger LOGGER = LoggerFactory.getLogger(RSocketServiceTransport.class);
33+
34+
static {
35+
Hooks.onErrorDropped(
36+
throwable -> {
37+
if (throwable instanceof AbortedException) {
38+
LOGGER.warn("[onErrorDropped] error: {}", throwable.toString());
39+
} else {
40+
LOGGER.error("[onErrorDropped] error:", throwable);
41+
}
42+
});
43+
}
44+
2845
private int numOfWorkers = Runtime.getRuntime().availableProcessors();
2946

3047
private HeadersCodec headersCodec = HeadersCodec.DEFAULT_INSTANCE;

0 commit comments

Comments
 (0)