This is an automated email from the ASF dual-hosted git repository.
nkalmar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zookeeper.git
The following commit(s) were added to refs/heads/master by this push:
new 4df268b ZOOKEEPER-3883: new UncaughtExceptionHandler object with
lambda
4df268b is described below
commit 4df268b970f525d128219ec81007355d77f6417c
Author: ZWShuai91 <[email protected]>
AuthorDate: Thu Aug 6 18:46:52 2020 +0200
ZOOKEEPER-3883: new UncaughtExceptionHandler object with lambda
Author: ZWShuai91 <[email protected]>
Reviewers: Enrico Olivelli <[email protected]>, Norbert Kalmar
<[email protected]>
Closes #1396 from ZWShuai91/ZOOKEEPER-3883
---
.../java/org/apache/zookeeper/server/NIOServerCnxnFactory.java | 6 +-----
.../main/java/org/apache/zookeeper/server/ZooKeeperThread.java | 8 +-------
2 files changed, 2 insertions(+), 12 deletions(-)
diff --git
a/zookeeper-server/src/main/java/org/apache/zookeeper/server/NIOServerCnxnFactory.java
b/zookeeper-server/src/main/java/org/apache/zookeeper/server/NIOServerCnxnFactory.java
index 558b93b..17fa362 100644
---
a/zookeeper-server/src/main/java/org/apache/zookeeper/server/NIOServerCnxnFactory.java
+++
b/zookeeper-server/src/main/java/org/apache/zookeeper/server/NIOServerCnxnFactory.java
@@ -82,11 +82,7 @@ public class NIOServerCnxnFactory extends ServerCnxnFactory {
public static final String ZOOKEEPER_NIO_SHUTDOWN_TIMEOUT =
"zookeeper.nio.shutdownTimeout";
static {
- Thread.setDefaultUncaughtExceptionHandler(new
Thread.UncaughtExceptionHandler() {
- public void uncaughtException(Thread t, Throwable e) {
- LOG.error("Thread {} died", t, e);
- }
- });
+ Thread.setDefaultUncaughtExceptionHandler((t, e) -> LOG.error("Thread
{} died", t, e));
/**
* Value of 0 disables use of direct buffers and instead uses
diff --git
a/zookeeper-server/src/main/java/org/apache/zookeeper/server/ZooKeeperThread.java
b/zookeeper-server/src/main/java/org/apache/zookeeper/server/ZooKeeperThread.java
index ab5c5f0..137b718 100644
---
a/zookeeper-server/src/main/java/org/apache/zookeeper/server/ZooKeeperThread.java
+++
b/zookeeper-server/src/main/java/org/apache/zookeeper/server/ZooKeeperThread.java
@@ -29,13 +29,7 @@ public class ZooKeeperThread extends Thread {
private static final Logger LOG =
LoggerFactory.getLogger(ZooKeeperThread.class);
- private UncaughtExceptionHandler uncaughtExceptionalHandler = new
UncaughtExceptionHandler() {
-
- @Override
- public void uncaughtException(Thread t, Throwable e) {
- handleException(t.getName(), e);
- }
- };
+ private UncaughtExceptionHandler uncaughtExceptionalHandler = (t, e) ->
handleException(t.getName(), e);
public ZooKeeperThread(String threadName) {
super(threadName);