Improve GRPC session error handling.
This commit is contained in:
		
							parent
							
								
									3ab8430a47
								
							
						
					
					
						commit
						bc7db03351
					
				@ -95,15 +95,24 @@ public final class GrpcSession implements Closeable {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void sendMsg(ClusterAPIProtos.ClusterMessage msg) {
 | 
					    public void sendMsg(ClusterAPIProtos.ClusterMessage msg) {
 | 
				
			||||||
        outputStream.onNext(msg);
 | 
					        if (connected) {
 | 
				
			||||||
    }
 | 
					            try {
 | 
				
			||||||
 | 
					                outputStream.onNext(msg);
 | 
				
			||||||
    public void onError(Throwable t) {
 | 
					            } catch (Throwable t) {
 | 
				
			||||||
        outputStream.onError(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
 | 
					    @Override
 | 
				
			||||||
    public void close() {
 | 
					    public void close() {
 | 
				
			||||||
 | 
					        connected = false;
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            outputStream.onCompleted();
 | 
					            outputStream.onCompleted();
 | 
				
			||||||
        } catch (IllegalStateException e) {
 | 
					        } catch (IllegalStateException e) {
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										4
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								pom.xml
									
									
									
									
									
								
							@ -61,10 +61,10 @@
 | 
				
			|||||||
        <mail.version>1.4.3</mail.version>
 | 
					        <mail.version>1.4.3</mail.version>
 | 
				
			||||||
        <curator.version>4.2.0</curator.version>
 | 
					        <curator.version>4.2.0</curator.version>
 | 
				
			||||||
        <protobuf.version>3.6.1</protobuf.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>
 | 
					        <lombok.version>1.16.18</lombok.version>
 | 
				
			||||||
        <paho.client.version>1.1.0</paho.client.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>
 | 
					        <os-maven-plugin.version>1.5.0</os-maven-plugin.version>
 | 
				
			||||||
        <rabbitmq.version>4.8.0</rabbitmq.version>
 | 
					        <rabbitmq.version>4.8.0</rabbitmq.version>
 | 
				
			||||||
        <surfire.version>2.19.1</surfire.version>
 | 
					        <surfire.version>2.19.1</surfire.version>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user