public class MasterHooks extends Object
Modifier and Type | Method and Description |
---|---|
static void |
close(Collection<MasterTriggerRestoreHook<?>> hooks,
org.slf4j.Logger log)
Closes the master hooks.
|
static void |
reset(Collection<MasterTriggerRestoreHook<?>> hooks,
org.slf4j.Logger log)
Resets the master hooks.
|
static void |
restoreMasterHooks(Map<String,MasterTriggerRestoreHook<?>> masterHooks,
Collection<MasterState> states,
long checkpointId,
boolean allowUnmatchedState,
org.slf4j.Logger log)
Calls the restore method given checkpoint master hooks and passes the given master state to
them where state with a matching name is found.
|
static <T> CompletableFuture<MasterState> |
triggerHook(MasterTriggerRestoreHook<T> hook,
long checkpointId,
long timestamp,
Executor executor)
Trigger master hook and return a completable future with state.
|
static <T> MasterTriggerRestoreHook<T> |
wrapHook(MasterTriggerRestoreHook<T> hook,
ClassLoader userClassLoader)
Wraps a hook such that the user-code classloader is applied when the hook is invoked.
|
public static void reset(Collection<MasterTriggerRestoreHook<?>> hooks, org.slf4j.Logger log) throws FlinkException
hooks
- The hooks to resetFlinkException
- Thrown, if the hooks throw an exception.public static void close(Collection<MasterTriggerRestoreHook<?>> hooks, org.slf4j.Logger log)
hooks
- The hooks to closepublic static <T> CompletableFuture<MasterState> triggerHook(MasterTriggerRestoreHook<T> hook, long checkpointId, long timestamp, Executor executor)
T
- The type of data produced by the hookhook
- The master hook givencheckpointId
- The checkpoint ID of the triggering checkpointtimestamp
- The (informational) timestamp for the triggering checkpointexecutor
- An executor that can be used for asynchronous I/O callspublic static void restoreMasterHooks(Map<String,MasterTriggerRestoreHook<?>> masterHooks, Collection<MasterState> states, long checkpointId, boolean allowUnmatchedState, org.slf4j.Logger log) throws FlinkException
If state is found and no hook with the same name is found, the method throws an exception,
unless the allowUnmatchedState
flag is set.
masterHooks
- The hooks to call restore onstates
- The state to pass to the hookscheckpointId
- The checkpoint ID of the restored checkpointallowUnmatchedState
- If true, the method fails if not all states are picked up by a
hook.log
- The logger for log messagesFlinkException
- Thrown, if the hooks throw an exception, or the state+ deserialization
fails.public static <T> MasterTriggerRestoreHook<T> wrapHook(MasterTriggerRestoreHook<T> hook, ClassLoader userClassLoader)
hook
- the hook to wrapuserClassLoader
- the classloader to useCopyright © 2014–2022 The Apache Software Foundation. All rights reserved.