Package org.apache.flink.runtime.rpc
Class MainThreadValidatorUtil
- java.lang.Object
-
- org.apache.flink.runtime.rpc.MainThreadValidatorUtil
-
public final class MainThreadValidatorUtil extends Object
This utility exists to bridge between the visibility of thecurrentMainThreadfield in theRpcEndpoint.The
currentMainThreadcan be hidden fromRpcEndpointimplementations and only be accessed via this utility from other packages.
-
-
Constructor Summary
Constructors Constructor Description MainThreadValidatorUtil(RpcEndpoint endpoint)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidenterMainThread()voidexitMainThread()static booleanisRunningInExpectedThread(Thread expected)Returns true iff the current thread is equals to the provided expected thread and logs violations.
-
-
-
Constructor Detail
-
MainThreadValidatorUtil
public MainThreadValidatorUtil(RpcEndpoint endpoint)
-
-
Method Detail
-
enterMainThread
public void enterMainThread()
-
exitMainThread
public void exitMainThread()
-
isRunningInExpectedThread
public static boolean isRunningInExpectedThread(@Nullable Thread expected)Returns true iff the current thread is equals to the provided expected thread and logs violations.- Parameters:
expected- the expected main thread.- Returns:
- true iff the current thread is equals to the provided expected thread.
-
-