From 6a48a10d945d98ed1395caed9bc0cd12c28b0dc9 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Tue, 19 Oct 2021 09:10:14 +0200 Subject: [PATCH] gRPC cleanup --- .../springframework/cloud/function/grpc/GrpcUtils.java | 7 ------- .../cloud/function/grpc/MessageHandlingHelper.java | 8 +------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/spring-cloud-function-adapters/spring-cloud-function-grpc/src/main/java/org/springframework/cloud/function/grpc/GrpcUtils.java b/spring-cloud-function-adapters/spring-cloud-function-grpc/src/main/java/org/springframework/cloud/function/grpc/GrpcUtils.java index 8e12836a7..36f0cb35d 100644 --- a/spring-cloud-function-adapters/spring-cloud-function-grpc/src/main/java/org/springframework/cloud/function/grpc/GrpcUtils.java +++ b/spring-cloud-function-adapters/spring-cloud-function-grpc/src/main/java/org/springframework/cloud/function/grpc/GrpcUtils.java @@ -16,9 +16,6 @@ package org.springframework.cloud.function.grpc; - -import java.io.Closeable; -import java.io.IOException; import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -241,7 +238,6 @@ final class GrpcUtils { e.printStackTrace(); responseObserver.onError(Status.UNKNOWN.withDescription("Error handling request") .withCause(e).asRuntimeException()); -// channel.shutdownNow(); }) .subscribe(); @@ -252,9 +248,6 @@ final class GrpcUtils { Thread.currentThread().interrupt(); throw new IllegalStateException(ie); } -// finally { -// channel.shutdownNow(); -// } } private static ClientResponseObserver clientResponseObserver(Flux> inputStream, Many> sink) { diff --git a/spring-cloud-function-adapters/spring-cloud-function-grpc/src/main/java/org/springframework/cloud/function/grpc/MessageHandlingHelper.java b/spring-cloud-function-adapters/spring-cloud-function-grpc/src/main/java/org/springframework/cloud/function/grpc/MessageHandlingHelper.java index deb1fd58b..530147056 100644 --- a/spring-cloud-function-adapters/spring-cloud-function-grpc/src/main/java/org/springframework/cloud/function/grpc/MessageHandlingHelper.java +++ b/spring-cloud-function-adapters/spring-cloud-function-grpc/src/main/java/org/springframework/cloud/function/grpc/MessageHandlingHelper.java @@ -47,7 +47,7 @@ import org.springframework.util.CollectionUtils; /** * * @author Oleg Zhurakousky - * + * @since 3.2 */ public class MessageHandlingHelper implements SmartLifecycle { @@ -147,7 +147,6 @@ public class MessageHandlingHelper implements Smar @Override public void onError(Throwable t) { t.printStackTrace(); -// responseObserver.onCompleted(); responseObserver.onError(Status.UNKNOWN.withDescription("Error handling request") .withCause(t).asRuntimeException()); } @@ -192,8 +191,6 @@ public class MessageHandlingHelper implements Smar UnsupportedOperationException ex = new UnsupportedOperationException("The bi-directional streaming is " + "not supported for functions that accept Publisher but return non-Publisher: " + function); -// responseObserver.onError(Status.UNKNOWN.withDescription("Error handling request") -// .withCause(ex).asException()); responseObserver.onCompleted(); throw ex; } @@ -205,8 +202,6 @@ public class MessageHandlingHelper implements Smar UnsupportedOperationException ex = new UnsupportedOperationException("The bidirection streaming is " + "not supported for functions that accept non-Publisher but return Publisher: " + function); -// responseObserver.onError(Status.UNKNOWN.withDescription("Error handling request") -// .withCause(ex).asException()); responseObserver.onCompleted(); throw ex; } @@ -243,7 +238,6 @@ public class MessageHandlingHelper implements Smar @Override public void onError(Throwable t) { t.printStackTrace(); - //responseObserver.onCompleted(); inputStream.tryEmitComplete(); responseObserver.onError(Status.UNKNOWN.withDescription("Error handling request") .withCause(t).asException());