This is an automated email from the ASF dual-hosted git repository.
xiangying pushed a commit to branch branch-2.10
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/branch-2.10 by this push:
new 240c22cce69 [fix][client][branch-2.10]Return local thread for the
`newThread` (#19779)
240c22cce69 is described below
commit 240c22cce69d99d69cbda84467787467b5bbbcb4
Author: Xiangying Meng <[email protected]>
AuthorDate: Sat Mar 11 10:10:29 2023 +0800
[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`.
---
.../src/main/java/org/apache/pulsar/client/util/ExecutorProvider.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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 8997d714194..90e1a59ed4d 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 @@ public class ExecutorProvider {
@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;
}
}