This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mina-sshd.git
commit 441ca31c9c5bf8c0b71aa9602b3e570e32be0703 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sun Jul 16 09:51:44 2023 -0400 No need to nest --- .../sshd/common/util/threads/ThreadUtils.java | 29 ++++++++++------------ 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/sshd-common/src/main/java/org/apache/sshd/common/util/threads/ThreadUtils.java b/sshd-common/src/main/java/org/apache/sshd/common/util/threads/ThreadUtils.java index 90780abad..d5e84d05b 100644 --- a/sshd-common/src/main/java/org/apache/sshd/common/util/threads/ThreadUtils.java +++ b/sshd-common/src/main/java/org/apache/sshd/common/util/threads/ThreadUtils.java @@ -62,13 +62,12 @@ public final class ThreadUtils { public static <V> V runAsInternal(Callable<V> code) throws Exception { if (isInternalThread()) { return code.call(); - } else { - try { - IS_INTERNAL_THREAD.set(Boolean.TRUE); - return code.call(); - } finally { - IS_INTERNAL_THREAD.remove(); - } + } + try { + IS_INTERNAL_THREAD.set(Boolean.TRUE); + return code.call(); + } finally { + IS_INTERNAL_THREAD.remove(); } } @@ -87,13 +86,12 @@ public final class ThreadUtils { public static <T, V> V runAsInternal(T param, IOFunction<? super T, V> code) throws IOException { if (isInternalThread()) { return code.apply(param); - } else { - try { - IS_INTERNAL_THREAD.set(Boolean.TRUE); - return code.apply(param); - } finally { - IS_INTERNAL_THREAD.remove(); - } + } + try { + IS_INTERNAL_THREAD.set(Boolean.TRUE); + return code.apply(param); + } finally { + IS_INTERNAL_THREAD.remove(); } } @@ -122,9 +120,8 @@ public final class ThreadUtils { CloseableExecutorService executorService, boolean shutdownOnExit) { if (executorService == null || shutdownOnExit || executorService instanceof NoCloseExecutor) { return executorService; - } else { - return new NoCloseExecutor(executorService); } + return new NoCloseExecutor(executorService); } public static CloseableExecutorService noClose(CloseableExecutorService executorService) {