From 71f4fde08ac891ef1d00ae6919dd9831492064d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E7=A7=B0=20Ma=20Chen?= Date: Fri, 4 Nov 2022 23:16:38 +0800 Subject: [PATCH] Format code (#906) --- .../core/executor/DynamicThreadPoolExecutor.java | 14 +++++++------- .../executor/ExtensibleThreadPoolExecutor.java | 14 +++++++------- .../cn/hippo4j/core/toolkit/inet/InetUtils.java | 4 ++-- .../config/rpc/support/NettyConnectPoolHolder.java | 6 ++---- 4 files changed, 18 insertions(+), 20 deletions(-) diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/DynamicThreadPoolExecutor.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/DynamicThreadPoolExecutor.java index e4feda74..6790a374 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/DynamicThreadPoolExecutor.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/DynamicThreadPoolExecutor.java @@ -80,13 +80,13 @@ public class DynamicThreadPoolExecutor extends ExtensibleThreadPoolExecutor impl * or {@code threadFactory} or {@code handler} is null */ public DynamicThreadPoolExecutor( - int corePoolSize, int maximumPoolSize, - long keepAliveTime, TimeUnit unit, - long executeTimeOut, boolean waitForTasksToCompleteOnShutdown, long awaitTerminationMillis, - @NonNull BlockingQueue blockingQueue, - @NonNull String threadPoolId, - @NonNull ThreadFactory threadFactory, - @NonNull RejectedExecutionHandler rejectedExecutionHandler) { + int corePoolSize, int maximumPoolSize, + long keepAliveTime, TimeUnit unit, + long executeTimeOut, boolean waitForTasksToCompleteOnShutdown, long awaitTerminationMillis, + @NonNull BlockingQueue blockingQueue, + @NonNull String threadPoolId, + @NonNull ThreadFactory threadFactory, + @NonNull RejectedExecutionHandler rejectedExecutionHandler) { super( threadPoolId, new DefaultThreadPoolPluginManager(), corePoolSize, maximumPoolSize, keepAliveTime, unit, diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/ExtensibleThreadPoolExecutor.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/ExtensibleThreadPoolExecutor.java index 95c8dc8c..87386a28 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/ExtensibleThreadPoolExecutor.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/ExtensibleThreadPoolExecutor.java @@ -88,13 +88,13 @@ public class ExtensibleThreadPoolExecutor extends ThreadPoolExecutor implements * or {@code threadFactory} or {@code handler} is null */ public ExtensibleThreadPoolExecutor( - @NonNull String threadPoolId, - @NonNull ThreadPoolPluginManager threadPoolPluginManager, - int corePoolSize, int maximumPoolSize, - long keepAliveTime, TimeUnit unit, - @NonNull BlockingQueue workQueue, - @NonNull ThreadFactory threadFactory, - @NonNull RejectedExecutionHandler handler) { + @NonNull String threadPoolId, + @NonNull ThreadPoolPluginManager threadPoolPluginManager, + int corePoolSize, int maximumPoolSize, + long keepAliveTime, TimeUnit unit, + @NonNull BlockingQueue workQueue, + @NonNull ThreadFactory threadFactory, + @NonNull RejectedExecutionHandler handler) { super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory, handler); // Pool extended info. this.threadPoolId = threadPoolId; diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/inet/InetUtils.java b/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/inet/InetUtils.java index 6d78ec83..5b933523 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/inet/InetUtils.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/inet/InetUtils.java @@ -75,7 +75,7 @@ public class InetUtils implements Closeable { try { int lowest = Integer.MAX_VALUE; for (Enumeration nics = NetworkInterface - .getNetworkInterfaces(); nics.hasMoreElements(); ) { + .getNetworkInterfaces(); nics.hasMoreElements();) { NetworkInterface ifc = nics.nextElement(); if (ifc.isUp()) { this.log.trace("Testing interface: " + ifc.getDisplayName()); @@ -86,7 +86,7 @@ public class InetUtils implements Closeable { } if (!ignoreInterface(ifc.getDisplayName())) { for (Enumeration addrs = ifc - .getInetAddresses(); addrs.hasMoreElements(); ) { + .getInetAddresses(); addrs.hasMoreElements();) { InetAddress address = addrs.nextElement(); if (address instanceof Inet4Address && !address.isLoopbackAddress() diff --git a/hippo4j-server/hippo4j-config/src/main/java/cn/hippo4j/config/rpc/support/NettyConnectPoolHolder.java b/hippo4j-server/hippo4j-config/src/main/java/cn/hippo4j/config/rpc/support/NettyConnectPoolHolder.java index d7cb7b86..37738798 100644 --- a/hippo4j-server/hippo4j-config/src/main/java/cn/hippo4j/config/rpc/support/NettyConnectPoolHolder.java +++ b/hippo4j-server/hippo4j-config/src/main/java/cn/hippo4j/config/rpc/support/NettyConnectPoolHolder.java @@ -84,10 +84,8 @@ public class NettyConnectPoolHolder { */ public static synchronized NettyConnectPool getPool(String host, int port, long timeout, EventLoopGroup worker) { - /* - * this cannot use the computeIfAbsent method directly here because put is already used in init. - * Details refer to https://bugs.openjdk.java.net/browse/JDK-8062841 - */ + // This cannot use the computeIfAbsent method directly here because put is already used in init. + // Details refer to https://bugs.openjdk.java.net/browse/JDK-8062841 NettyConnectPool pool = getPool(host, port); return pool == null ? initPool(host, port, timeout, worker) : pool; }