THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||
---|---|---|
| ||
interface FailureHandler {
boolean onFailure(Ignite ignite, FailureContext failureCtx);
}
class FailureContext {
FailureType type;
Throwable error;
}
enum FailureType {
SEGMENTATION,
SYSTEM_WORKER_TERMINATION,
CRITICAL_ERROR
} |
...
Default failure handler is StopNodeOrHaltFailureProcessor
where tryStop
value is false
.
Critical system worker must catch all exceptions ( Throwable
and derived classes) in high-level try-catch
block and take into account that thread could be terminated due to an programmatic mistake that leads to unintentional worker termination. So basic template should looks like the following code snippet:
Code Block | ||
---|---|---|
| ||
@Override public void run() { Throwable err = null; try { // Critical worker's code. } catch(Throwable e) { err = e; } finally { // Call failure handler. FailureContext failureCtx = new FaulureCtx(FailureType.SYSTEM_WORKER_TERMINATION, err); FailureHandler failureHnd = failureHandler(); // Get failure handler configured by user. failureHnd.onFailure(ignite, failureCtx); // Handle failure. } } |
...