Språk

UrlRequest.Builder.SetDirectExecutorAllowed(Boolean) Method

Definition

Sets whether the request can use an executor that runs tasks inline.

[Android.Runtime.Register("setDirectExecutorAllowed", "(Z)Landroid/net/http/UrlRequest$Builder;", "GetSetDirectExecutorAllowed_ZHandler", ApiSince=34)]
public abstract Android.Net.Http.UrlRequest.Builder SetDirectExecutorAllowed(bool allowDirectExecutor);
[<Android.Runtime.Register("setDirectExecutorAllowed", "(Z)Landroid/net/http/UrlRequest$Builder;", "GetSetDirectExecutorAllowed_ZHandler", ApiSince=34)>]
abstract member SetDirectExecutorAllowed : bool -> Android.Net.Http.UrlRequest.Builder

Parameters

allowDirectExecutor
Boolean

true to allow executors performing inline execution, false otherwise.

Returns

the builder to facilitate chaining. This value cannot be null.

Attributes

Remarks

Do not call SetDirectExecutorAllowed(false) on older versions of HttpEngine, because it may cause incorrect behavior. This option indicates whether the request's callback executors intentionally run tasks inline, as with Guava's direct executor or ThreadPoolExecutor.CallerRunsPolicy.

Warning: If set to true: This option makes it easy to accidentally block the network thread. This should not be done if your callbacks perform disk I/O, acquire locks, or call into other code you don't carefully control and audit.

Android reference for android.net.http.UrlRequest.Builder.setDirectExecutorAllowed.

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