public final class MainThreadValidatorUtil extends Object
currentMainThread field in
the RpcEndpoint.
The currentMainThread can be hidden from RpcEndpoint implementations and only
be accessed via this utility from other packages.
| Constructor and Description |
|---|
MainThreadValidatorUtil(RpcEndpoint endpoint) |
| Modifier and Type | Method and Description |
|---|---|
void |
enterMainThread() |
void |
exitMainThread() |
static boolean |
isRunningInExpectedThread(Thread expected)
Returns true iff the current thread is equals to the provided expected thread and logs
violations.
|
public MainThreadValidatorUtil(RpcEndpoint endpoint)
public void enterMainThread()
public void exitMainThread()
public static boolean isRunningInExpectedThread(@Nullable Thread expected)
expected - the expected main thread.Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.