Improve GRPC session error handling.

This commit is contained in:
Igor Kulikov 2019-03-29 13:50:52 +02:00
parent 3ab8430a47
commit bc7db03351
2 changed files with 16 additions and 7 deletions

View File

@ -95,15 +95,24 @@ public final class GrpcSession implements Closeable {
}
public void sendMsg(ClusterAPIProtos.ClusterMessage msg) {
outputStream.onNext(msg);
}
public void onError(Throwable t) {
outputStream.onError(t);
if (connected) {
try {
outputStream.onNext(msg);
} catch (Throwable t) {
try {
outputStream.onError(t);
} catch (Throwable t2) {
}
listener.onError(GrpcSession.this, t);
}
} else {
log.warn("[{}] Failed to send message due to closed session!", sessionId);
}
}
@Override
public void close() {
connected = false;
try {
outputStream.onCompleted();
} catch (IllegalStateException e) {

View File

@ -61,10 +61,10 @@
<mail.version>1.4.3</mail.version>
<curator.version>4.2.0</curator.version>
<protobuf.version>3.6.1</protobuf.version>
<grpc.version>1.16.1</grpc.version>
<grpc.version>1.19.0</grpc.version>
<lombok.version>1.16.18</lombok.version>
<paho.client.version>1.1.0</paho.client.version>
<netty.version>4.1.30.Final</netty.version>
<netty.version>4.1.34.Final</netty.version>
<os-maven-plugin.version>1.5.0</os-maven-plugin.version>
<rabbitmq.version>4.8.0</rabbitmq.version>
<surfire.version>2.19.1</surfire.version>