Format code

pull/906/head
chen.ma 3 years ago
parent 517779cf8a
commit 91be26989c

@ -80,13 +80,13 @@ public class DynamicThreadPoolExecutor extends ExtensibleThreadPoolExecutor impl
* or {@code threadFactory} or {@code handler} is null * or {@code threadFactory} or {@code handler} is null
*/ */
public DynamicThreadPoolExecutor( public DynamicThreadPoolExecutor(
int corePoolSize, int maximumPoolSize, int corePoolSize, int maximumPoolSize,
long keepAliveTime, TimeUnit unit, long keepAliveTime, TimeUnit unit,
long executeTimeOut, boolean waitForTasksToCompleteOnShutdown, long awaitTerminationMillis, long executeTimeOut, boolean waitForTasksToCompleteOnShutdown, long awaitTerminationMillis,
@NonNull BlockingQueue<Runnable> blockingQueue, @NonNull BlockingQueue<Runnable> blockingQueue,
@NonNull String threadPoolId, @NonNull String threadPoolId,
@NonNull ThreadFactory threadFactory, @NonNull ThreadFactory threadFactory,
@NonNull RejectedExecutionHandler rejectedExecutionHandler) { @NonNull RejectedExecutionHandler rejectedExecutionHandler) {
super( super(
threadPoolId, new DefaultThreadPoolPluginManager(), threadPoolId, new DefaultThreadPoolPluginManager(),
corePoolSize, maximumPoolSize, keepAliveTime, unit, corePoolSize, maximumPoolSize, keepAliveTime, unit,

@ -88,13 +88,13 @@ public class ExtensibleThreadPoolExecutor extends ThreadPoolExecutor implements
* or {@code threadFactory} or {@code handler} is null * or {@code threadFactory} or {@code handler} is null
*/ */
public ExtensibleThreadPoolExecutor( public ExtensibleThreadPoolExecutor(
@NonNull String threadPoolId, @NonNull String threadPoolId,
@NonNull ThreadPoolPluginManager threadPoolPluginManager, @NonNull ThreadPoolPluginManager threadPoolPluginManager,
int corePoolSize, int maximumPoolSize, int corePoolSize, int maximumPoolSize,
long keepAliveTime, TimeUnit unit, long keepAliveTime, TimeUnit unit,
@NonNull BlockingQueue<Runnable> workQueue, @NonNull BlockingQueue<Runnable> workQueue,
@NonNull ThreadFactory threadFactory, @NonNull ThreadFactory threadFactory,
@NonNull RejectedExecutionHandler handler) { @NonNull RejectedExecutionHandler handler) {
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory, handler); super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory, handler);
// Pool extended info. // Pool extended info.
this.threadPoolId = threadPoolId; this.threadPoolId = threadPoolId;

@ -75,7 +75,7 @@ public class InetUtils implements Closeable {
try { try {
int lowest = Integer.MAX_VALUE; int lowest = Integer.MAX_VALUE;
for (Enumeration<NetworkInterface> nics = NetworkInterface for (Enumeration<NetworkInterface> nics = NetworkInterface
.getNetworkInterfaces(); nics.hasMoreElements(); ) { .getNetworkInterfaces(); nics.hasMoreElements();) {
NetworkInterface ifc = nics.nextElement(); NetworkInterface ifc = nics.nextElement();
if (ifc.isUp()) { if (ifc.isUp()) {
this.log.trace("Testing interface: " + ifc.getDisplayName()); this.log.trace("Testing interface: " + ifc.getDisplayName());
@ -86,7 +86,7 @@ public class InetUtils implements Closeable {
} }
if (!ignoreInterface(ifc.getDisplayName())) { if (!ignoreInterface(ifc.getDisplayName())) {
for (Enumeration<InetAddress> addrs = ifc for (Enumeration<InetAddress> addrs = ifc
.getInetAddresses(); addrs.hasMoreElements(); ) { .getInetAddresses(); addrs.hasMoreElements();) {
InetAddress address = addrs.nextElement(); InetAddress address = addrs.nextElement();
if (address instanceof Inet4Address if (address instanceof Inet4Address
&& !address.isLoopbackAddress() && !address.isLoopbackAddress()

@ -84,10 +84,8 @@ public class NettyConnectPoolHolder {
*/ */
public static synchronized NettyConnectPool getPool(String host, int port, public static synchronized NettyConnectPool getPool(String host, int port,
long timeout, EventLoopGroup worker) { long timeout, EventLoopGroup worker) {
/* // This cannot use the computeIfAbsent method directly here because put is already used in init.
* 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
* Details refer to https://bugs.openjdk.java.net/browse/JDK-8062841
*/
NettyConnectPool pool = getPool(host, port); NettyConnectPool pool = getPool(host, port);
return pool == null ? initPool(host, port, timeout, worker) : pool; return pool == null ? initPool(host, port, timeout, worker) : pool;
} }

Loading…
Cancel
Save