ThreadPoolExecutor.SetKeepAliveTime(Int64, TimeUnit) 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.
Sets the thread keep-alive time, which is the amount of time that threads may remain idle before being terminated.
[Android.Runtime.Register("setKeepAliveTime", "(JLjava/util/concurrent/TimeUnit;)V", "GetSetKeepAliveTime_JLjava_util_concurrent_TimeUnit_Handler")]
public virtual void SetKeepAliveTime (long time, Java.Util.Concurrent.TimeUnit? unit);
[<Android.Runtime.Register("setKeepAliveTime", "(JLjava/util/concurrent/TimeUnit;)V", "GetSetKeepAliveTime_JLjava_util_concurrent_TimeUnit_Handler")>]
abstract member SetKeepAliveTime : int64 * Java.Util.Concurrent.TimeUnit -> unit
override this.SetKeepAliveTime : int64 * Java.Util.Concurrent.TimeUnit -> unit
Parameters
- time
- Int64
the time to wait. A time value of zero will cause excess threads to terminate immediately after executing tasks.
- unit
- TimeUnit
the time unit of the time
argument
- Attributes
Exceptions
if time
less than zero or
if time
is zero and allowsCoreThreadTimeOut
Remarks
Sets the thread keep-alive time, which is the amount of time that threads may remain idle before being terminated. Threads that wait this amount of time without processing a task will be terminated if there are more than the core number of threads currently in the pool, or if this pool #allowsCoreThreadTimeOut() allows core thread timeout. This overrides any value set in the constructor.
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.