語言

AsynchronousChannelGroup.WithThreadPool(IExecutorService) 方法

定義

建立一個非同步通道群組,並設定給定的執行緒池。

[Android.Runtime.Register("withThreadPool", "(Ljava/util/concurrent/ExecutorService;)Ljava/nio/channels/AsynchronousChannelGroup;", "", ApiSince=26)]
public static Java.Nio.Channels.AsynchronousChannelGroup? WithThreadPool(Java.Util.Concurrent.IExecutorService? executor);
[<Android.Runtime.Register("withThreadPool", "(Ljava/util/concurrent/ExecutorService;)Ljava/nio/channels/AsynchronousChannelGroup;", "", ApiSince=26)>]
static member WithThreadPool : Java.Util.Concurrent.IExecutorService -> Java.Nio.Channels.AsynchronousChannelGroup

參數

executor
IExecutorService

產生後群組的執行緒池

傳回

一個新的非同步通道群組

屬性

備註

建立一個非同步通道群組,並設定給定的執行緒池。

executor參數為 ,ExecutorService執行提交的任務,以派遣群組內非同步通道啟動的操作完成結果。

設定執行器服務時需特別小心。 它應該支援<>直接交接</EM> 或><無界佇列</>em 提交任務,而呼叫該ExecutorService#execute execute方法的執行緒絕不應直接呼叫該任務。 實作可能會要求額外的限制。

執行者設計為專門供非同步通道群組使用。 團體終止後,執行人服務的秩序 ExecutorService#shutdown shutdown 將被安排。 以其他方式關閉執行者服務會導致未明確的行為。

該群組是透過調用 AsynchronousChannelProvider#openAsynchronousChannelGroup(ExecutorService,int) openAsynchronousChannelGroup(ExecutorService,int) 系統範圍預設 AsynchronousChannelProvider 物件的方法建立的,且 initialSize0

java.nio.channels.AsynchronousChannelGroup.withThreadPool(java.util.concurrent.ExecutorService)Java 檔。

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於