AsynchronousChannelGroup.WithCachedThreadPool(IExecutorService, Int32) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
建立一個非同步通道群組,並以特定執行緒池建立,並根據需要建立新的執行緒。
[Android.Runtime.Register("withCachedThreadPool", "(Ljava/util/concurrent/ExecutorService;I)Ljava/nio/channels/AsynchronousChannelGroup;", "", ApiSince=26)]
public static Java.Nio.Channels.AsynchronousChannelGroup? WithCachedThreadPool(Java.Util.Concurrent.IExecutorService? executor, int initialSize);
[<Android.Runtime.Register("withCachedThreadPool", "(Ljava/util/concurrent/ExecutorService;I)Ljava/nio/channels/AsynchronousChannelGroup;", "", ApiSince=26)>]
static member WithCachedThreadPool : Java.Util.Concurrent.IExecutorService * int -> Java.Nio.Channels.AsynchronousChannelGroup
參數
- executor
- IExecutorService
產生後群組的執行緒池
- initialSize
- Int32
針對實作特定的預設值或 >=0 負值
傳回
一個新的非同步通道群組
- 屬性
備註
建立一個非同步通道群組,並以特定執行緒池建立,並根據需要建立新的執行緒。
executor參數為 ,ExecutorService根據需要建立新執行緒以執行提交的任務,處理 I/O 事件並派遣群組內非同步通道啟動的操作完成結果。 當先前建構的執行緒可用時,可能會重複使用。
initialSize該參數可被實作用作<初始任務數量的提示></em>。 例如,它可以用來表示等待 I/O 事件的初始執行緒數量。
執行者設計為專門供非同步通道群組使用。 團體終止後,執行人服務的秩序 ExecutorService#shutdown shutdown 將被安排。 以其他方式關閉執行者服務會導致未明確的行為。
該群組是透過調用 AsynchronousChannelProvider#openAsynchronousChannelGroup(ExecutorService,int) openAsynchronousChannelGroup(ExecutorService,int) 系統範圍預設 AsynchronousChannelProvider 物件的方法來建立的。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。