Executors.NewSingleThreadExecutor Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
NewSingleThreadExecutor() |
Creates an Executor that uses a single worker thread operating off an unbounded queue. |
NewSingleThreadExecutor(IThreadFactory) |
Creates an Executor that uses a single worker thread operating off an unbounded queue, and uses the provided ThreadFactory to create a new thread when needed. |
NewSingleThreadExecutor()
Creates an Executor that uses a single worker thread operating off an unbounded queue.
[Android.Runtime.Register("newSingleThreadExecutor", "()Ljava/util/concurrent/ExecutorService;", "")]
public static Java.Util.Concurrent.IExecutorService? NewSingleThreadExecutor ();
[<Android.Runtime.Register("newSingleThreadExecutor", "()Ljava/util/concurrent/ExecutorService;", "")>]
static member NewSingleThreadExecutor : unit -> Java.Util.Concurrent.IExecutorService
Returns
the newly created single-threaded Executor
- Attributes
Remarks
Creates an Executor that uses a single worker thread operating off an unbounded queue. (Note however that if this single thread terminates due to a failure during execution prior to shutdown, a new one will take its place if needed to execute subsequent tasks.) Tasks are guaranteed to execute sequentially, and no more than one task will be active at any given time. Unlike the otherwise equivalent newFixedThreadPool(1)
the returned executor is guaranteed not to be reconfigurable to use additional threads.
Java documentation for java.util.concurrent.Executors.newSingleThreadExecutor()
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
NewSingleThreadExecutor(IThreadFactory)
Creates an Executor that uses a single worker thread operating off an unbounded queue, and uses the provided ThreadFactory to create a new thread when needed.
[Android.Runtime.Register("newSingleThreadExecutor", "(Ljava/util/concurrent/ThreadFactory;)Ljava/util/concurrent/ExecutorService;", "")]
public static Java.Util.Concurrent.IExecutorService? NewSingleThreadExecutor (Java.Util.Concurrent.IThreadFactory? threadFactory);
[<Android.Runtime.Register("newSingleThreadExecutor", "(Ljava/util/concurrent/ThreadFactory;)Ljava/util/concurrent/ExecutorService;", "")>]
static member NewSingleThreadExecutor : Java.Util.Concurrent.IThreadFactory -> Java.Util.Concurrent.IExecutorService
Parameters
- threadFactory
- IThreadFactory
the factory to use when creating new threads
Returns
the newly created single-threaded Executor
- Attributes
Exceptions
if threadFactory is null
Remarks
Creates an Executor that uses a single worker thread operating off an unbounded queue, and uses the provided ThreadFactory to create a new thread when needed. Unlike the otherwise equivalent newFixedThreadPool(1, threadFactory)
the returned executor is guaranteed not to be reconfigurable to use additional threads.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.