다음을 통해 공유


ThreadPoolExecutor.AllowCoreThreadTimeOut(Boolean) Method

Definition

Sets the policy governing whether core threads may time out and terminate if no tasks arrive within the keep-alive time, being replaced if needed when new tasks arrive.

[Android.Runtime.Register("allowCoreThreadTimeOut", "(Z)V", "GetAllowCoreThreadTimeOut_ZHandler")]
public virtual void AllowCoreThreadTimeOut (bool value);
[<Android.Runtime.Register("allowCoreThreadTimeOut", "(Z)V", "GetAllowCoreThreadTimeOut_ZHandler")>]
abstract member AllowCoreThreadTimeOut : bool -> unit
override this.AllowCoreThreadTimeOut : bool -> unit

Parameters

value
Boolean

true if should time out, else false

Attributes

Exceptions

if value is true and the current keep-alive time is not greater than zero

Remarks

Sets the policy governing whether core threads may time out and terminate if no tasks arrive within the keep-alive time, being replaced if needed when new tasks arrive. When false, core threads are never terminated due to lack of incoming tasks. When true, the same keep-alive policy applying to non-core threads applies also to core threads. To avoid continual thread replacement, the keep-alive time must be greater than zero when setting true. This method should in general be called before the pool is actively used.

Added in 1.6.

Java documentation for java.util.concurrent.ThreadPoolExecutor.allowCoreThreadTimeOut(boolean).

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