commit | 240c22cce69d99d69cbda84467787467b5bbbcb4 | [log] [tgz] |
---|---|---|
author | Xiangying Meng <55571188+liangyepianzhou@users.noreply.github.com> | Sat Mar 11 10:10:29 2023 +0800 |
committer | GitHub <noreply@github.com> | Sat Mar 11 10:10:29 2023 +0800 |
tree | 99a9992d1ccbada8a5dc692402467bc7490038ee | |
parent | 36794d90081cd4fb1b1b17fafbd998e123c04aae [diff] |
[fix][client][branch-2.10]Return local thread for the `newThread` (#19779) ### Motivation The original fix is https://github.com/apache/pulsar/pull/18268. But after the fix is cherry-picked, the fix is overridden when resolving conflicts for cherry-pick https://github.com/apache/pulsar/pull/18211. ### Modifications Return the local thread variables in the `newThread`.
diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/util/ExecutorProvider.java b/pulsar-client/src/main/java/org/apache/pulsar/client/util/ExecutorProvider.java index 8997d71..90e1a59 100644 --- a/pulsar-client/src/main/java/org/apache/pulsar/client/util/ExecutorProvider.java +++ b/pulsar-client/src/main/java/org/apache/pulsar/client/util/ExecutorProvider.java
@@ -52,9 +52,10 @@ @Override public Thread newThread(Runnable r) { - thread = super.newThread(r); + Thread thread = super.newThread(r); thread.setUncaughtExceptionHandler((t, e) -> log.error("Thread {} got uncaught Exception", t.getName(), e)); + this.thread = thread; return thread; } }