You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by cr...@apache.org on 2022/07/27 03:03:05 UTC

[dubbo] branch 3.0 updated: Fix CallbackRegistrationInvoker skip when throw exception (#10349)

This is an automated email from the ASF dual-hosted git repository.

crazyhzm pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.0 by this push:
     new 904703eb22 Fix CallbackRegistrationInvoker skip when throw exception (#10349)
904703eb22 is described below

commit 904703eb2265baa3e210da815f9db3d5ea0e66d8
Author: Albumen Kevin <jh...@gmail.com>
AuthorDate: Wed Jul 27 11:02:55 2022 +0800

    Fix CallbackRegistrationInvoker skip when throw exception (#10349)
---
 .../org/apache/dubbo/rpc/cluster/filter/FilterChainBuilder.java  | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/filter/FilterChainBuilder.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/filter/FilterChainBuilder.java
index c01c5b67a9..2911eac412 100644
--- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/filter/FilterChainBuilder.java
+++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/filter/FilterChainBuilder.java
@@ -192,6 +192,7 @@ public interface FilterChainBuilder {
         public Result invoke(Invocation invocation) throws RpcException {
             Result asyncResult = filterInvoker.invoke(invocation);
             asyncResult.whenCompleteWithContext((r, t) -> {
+                RuntimeException filterRuntimeException = null;
                 for (int i = filters.size() - 1; i >= 0; i--) {
                     FILTER filter = filters.get(i);
                     try {
@@ -218,14 +219,18 @@ public interface FilterChainBuilder {
                                 listener.onError(t, filterInvoker, invocation);
                             }
                         }
-                    } catch (Throwable filterThrowable) {
+                    } catch (RuntimeException runtimeException) {
                         LOGGER.error(String.format("Exception occurred while executing the %s filter named %s.", i, filter.getClass().getSimpleName()));
                         if (LOGGER.isDebugEnabled()) {
                             LOGGER.debug(String.format("Whole filter list is: %s", filters.stream().map(tmpFilter -> tmpFilter.getClass().getSimpleName()).collect(Collectors.toList())));
                         }
-                        throw filterThrowable;
+                        filterRuntimeException = runtimeException;
+                        t = runtimeException;
                     }
                 }
+                if (filterRuntimeException != null) {
+                    throw filterRuntimeException;
+                }
             });
 
             return asyncResult;