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 List<MasterState> |
triggerMasterHooks(Collection<MasterTriggerRestoreHook<?>> hooks,
long checkpointId,
long timestamp,
Executor executor,
Time timeout)
Triggers all given master hooks and returns state objects for each hook that
produced a 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) throws FlinkException
hooks
- The hooks to closeFlinkException
- Thrown, if the hooks throw an exception.public static List<MasterState> triggerMasterHooks(Collection<MasterTriggerRestoreHook<?>> hooks, long checkpointId, long timestamp, Executor executor, Time timeout) throws FlinkException
hooks
- The hooks to triggercheckpointId
- The checkpoint ID of the triggering checkpointtimestamp
- The (informational) timestamp for the triggering checkpointexecutor
- An executor that can be used for asynchronous I/O callstimeout
- The maximum time that a hook may take to completeFlinkException
- Thrown, if the hooks throw an exception, or the state+
deserialization fails.public 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–2019 The Apache Software Foundation. All rights reserved.