Skip to content

Commit d70458f

Browse files
committed
Remove redundant catch blocks for method calls on the ext-proc request observer.
1 parent 1519d5d commit d70458f

File tree

1 file changed

+6
-30
lines changed

1 file changed

+6
-30
lines changed

xds/src/main/java/io/grpc/xds/ExternalProcessorFilter.java

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -475,11 +475,7 @@ else if (response.hasRequestBody()) {
475475
.asRuntimeException();
476476
synchronized (streamLock) {
477477
if (!extProcStreamCompleted.get() && extProcClientCallRequestObserver != null) {
478-
try {
479-
extProcClientCallRequestObserver.onError(ex);
480-
} catch (IllegalStateException | io.grpc.StatusRuntimeException e) {
481-
// Ignore
482-
}
478+
extProcClientCallRequestObserver.onError(ex);
483479
}
484480
}
485481
onError(ex);
@@ -508,11 +504,7 @@ else if (response.hasResponseBody()) {
508504
.asRuntimeException();
509505
synchronized (streamLock) {
510506
if (!extProcStreamCompleted.get() && extProcClientCallRequestObserver != null) {
511-
try {
512-
extProcClientCallRequestObserver.onError(ex);
513-
} catch (IllegalStateException | io.grpc.StatusRuntimeException e) {
514-
// Ignore
515-
}
507+
extProcClientCallRequestObserver.onError(ex);
516508
}
517509
}
518510
onError(ex);
@@ -577,11 +569,7 @@ public void onCompleted() {
577569
private void sendToExtProc(ProcessingRequest request) {
578570
synchronized (streamLock) {
579571
if (!extProcStreamCompleted.get() && extProcClientCallRequestObserver != null) {
580-
try {
581-
extProcClientCallRequestObserver.onNext(request);
582-
} catch (IllegalStateException | io.grpc.StatusRuntimeException e) {
583-
// Ignore if stream is already closed
584-
}
572+
extProcClientCallRequestObserver.onNext(request);
585573
}
586574
}
587575
}
@@ -604,11 +592,7 @@ private void closeExtProcStream() {
604592
synchronized (streamLock) {
605593
if (extProcStreamCompleted.compareAndSet(false, true)) {
606594
if (extProcClientCallRequestObserver != null) {
607-
try {
608-
extProcClientCallRequestObserver.onCompleted();
609-
} catch (IllegalStateException | io.grpc.StatusRuntimeException e) {
610-
// Ignore if already closed
611-
}
595+
extProcClientCallRequestObserver.onCompleted();
612596
}
613597
}
614598
}
@@ -617,11 +601,7 @@ private void closeExtProcStream() {
617601
private void halfCloseExtProcStream() {
618602
synchronized (streamLock) {
619603
if (!extProcStreamCompleted.get() && extProcClientCallRequestObserver != null) {
620-
try {
621-
extProcClientCallRequestObserver.onCompleted();
622-
} catch (IllegalStateException | io.grpc.StatusRuntimeException e) {
623-
// Ignore
624-
}
604+
extProcClientCallRequestObserver.onCompleted();
625605
}
626606
}
627607
}
@@ -726,11 +706,7 @@ public void halfClose() {
726706
public void cancel(@Nullable String message, @Nullable Throwable cause) {
727707
synchronized (streamLock) {
728708
if (!extProcStreamCompleted.get() && extProcClientCallRequestObserver != null) {
729-
try {
730-
extProcClientCallRequestObserver.onError(Status.CANCELLED.withDescription(message).withCause(cause).asRuntimeException());
731-
} catch (IllegalStateException | io.grpc.StatusRuntimeException e) {
732-
// Ignore
733-
}
709+
extProcClientCallRequestObserver.onError(Status.CANCELLED.withDescription(message).withCause(cause).asRuntimeException());
734710
}
735711
}
736712
super.cancel(message, cause);

0 commit comments

Comments
 (0)