Package org.miaixz.bus.socket.channel
Class EnhanceAsynchronousChannelGroup
java.lang.Object
java.nio.channels.AsynchronousChannelGroup
org.miaixz.bus.socket.channel.EnhanceAsynchronousChannelGroup
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEnhanceAsynchronousChannelGroup(AsynchronousChannelProvider provider, ExecutorService readExecutorService, int threadNum) 初始化该类的新实例 -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long timeout, TimeUnit unit) voidinterestOps(EnhanceAsynchronousChannelGroup.Worker worker, SelectionKey selectionKey, int opt) booleanbooleanvoidregisterFuture(Consumer<Selector> register, int opType) 同步IO注册异步线程,防止主IO线程阻塞voidremoveOps(SelectionKey selectionKey, int opt) 移除关注事件voidshutdown()voidMethods inherited from class java.nio.channels.AsynchronousChannelGroup
provider, withCachedThreadPool, withFixedThreadPool, withThreadPool
-
Field Details
-
MAX_INVOKER
public static final int MAX_INVOKER递归回调次数上限- See Also:
-
-
Constructor Details
-
EnhanceAsynchronousChannelGroup
public EnhanceAsynchronousChannelGroup(AsynchronousChannelProvider provider, ExecutorService readExecutorService, int threadNum) throws IOException 初始化该类的新实例- Parameters:
provider- 此组的异步通道提供程序readExecutorService- 执行服务threadNum- 线程数量- Throws:
IOException- 异常
-
-
Method Details
-
registerFuture
同步IO注册异步线程,防止主IO线程阻塞- Throws:
IOException
-
removeOps
移除关注事件- Parameters:
selectionKey- 待操作的selectionKeyopt- 移除的事件
-
getReadWorker
-
getWriteWorker
-
getAcceptWorker
-
getConnectWorker
-
getScheduledExecutor
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin classAsynchronousChannelGroup
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin classAsynchronousChannelGroup
-
shutdown
public void shutdown()- Specified by:
shutdownin classAsynchronousChannelGroup
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin classAsynchronousChannelGroup
-
awaitTermination
- Specified by:
awaitTerminationin classAsynchronousChannelGroup- Throws:
InterruptedException
-
interestOps
public void interestOps(EnhanceAsynchronousChannelGroup.Worker worker, SelectionKey selectionKey, int opt)
-