@Override public void apply(Throwable t) { if (grid != null) grid.context().failure().process(new FailureContext(SYSTEM_WORKER_TERMINATION, t)); } },
/** {@inheritDoc} */ @Override protected boolean handle(Ignite ignite, FailureContext failureCtx) { failure = true; error = failureCtx.error(); return true; } }
/** {@inheritDoc} */ @Override public boolean onFailure(Ignite ignite, FailureContext failureCtx) { return !ignoredFailureTypes.contains(failureCtx.type()) && handle(ignite, failureCtx); }
/** {@inheritDoc} */ @Override public byte state(long crdVer, long cntr) { assert txLog != null && mvccEnabled; try { return txLog.get(crdVer, cntr); } catch (IgniteCheckedException e) { ctx.failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e)); } return TxState.NA; }
@Override protected boolean handle(Ignite ignite, FailureContext failureCtx) { if (failureCtx.type() != FailureType.SYSTEM_CRITICAL_OPERATION_TIMEOUT) return true; if (hndLatch != null) hndLatch.countDown(); return false; } };
@Override protected boolean handle(Ignite ignite, FailureContext failureCtx) { err.compareAndSet(null, failureCtx.error()); stop.set(true); return false; } });
/** * Invoke failure handler and rethrow passed exception, possibly wrapped into the unchecked one. */ private RuntimeException criticalError(Throwable e) { ctx.failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e)); if (e instanceof Error) throw (Error) e; throw U.convertException((IgniteCheckedException)e); }
@Override protected boolean handle(Ignite ignite, FailureContext failureCtx) { if (failureCtx.type() == FailureType.SYSTEM_WORKER_BLOCKED) hndLatch.countDown(); return false; } };
@Override public void apply(Throwable t) { if (grid != null) grid.context().failure().process(new FailureContext(SYSTEM_WORKER_TERMINATION, t)); } },
/** {@inheritDoc} */ @Override protected boolean handle(Ignite ignite, FailureContext failureCtx) { if (failureCtx.type() == FailureType.SYSTEM_WORKER_TERMINATION) failureHndThreadName = Thread.currentThread().getName(); return false; } }
/** * @throws Exception If failed. */ private void failFormatFileOnClusterActivate() throws Exception { failMtdNameRef.set(null); startGrid(0); startGrid(1); if (!fsync) { setFileIOFactory(grid(0).context().cache().context().wal()); setFileIOFactory(grid(1).context().cache().context().wal()); } failMtdNameRef.set(formatFile); grid(0).cluster().active(true); checkCause(failureHandler(0).awaitFailure(2000).error()); checkCause(failureHandler(1).awaitFailure(2000).error()); }
/** {@inheritDoc} */ @Override public void uncaughtException(Thread t, Throwable e) { if (X.hasCause(e, OutOfMemoryError.class)) ctx.failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e)); } }
/** {@inheritDoc} */ @Override public boolean segmented() { FailureProcessor failureProc = failure(); return failureProc != null && failureProc.failureContext() != null && failureProc.failureContext().type() == FailureType.SEGMENTATION; }
assertTrue(X.hasCause(dummyFailureHandler(ignite1).failureContext().error(), IgniteOutOfMemoryException.class));
/** {@inheritDoc} */ @Override public void storeCacheData(StoredCacheData cacheData, boolean overwrite) throws IgniteCheckedException { File cacheWorkDir = cacheWorkDir(cacheData.config()); File file; checkAndInitCacheWorkDir(cacheWorkDir); assert cacheWorkDir.exists() : "Work directory does not exist: " + cacheWorkDir; if (cacheData.config().getGroupName() != null) file = new File(cacheWorkDir, cacheData.config().getName() + CACHE_DATA_FILENAME); else file = new File(cacheWorkDir, CACHE_DATA_FILENAME); Path filePath = file.toPath(); try { if (overwrite || !Files.exists(filePath) || Files.size(filePath) == 0) { File tmp = new File(file.getParent(), file.getName() + TMP_SUFFIX); if (tmp.exists() && !tmp.delete()) { log.warning("Failed to delete temporary cache config file" + "(make sure Ignite process has enough rights):" + file.getName()); } // Pre-existing file will be truncated upon stream open. try (OutputStream stream = new BufferedOutputStream(new FileOutputStream(tmp))) { marshaller.marshal(cacheData, stream); } Files.move(tmp.toPath(), file.toPath(), StandardCopyOption.REPLACE_EXISTING); } } catch (IOException ex) { cctx.kernalContext().failure().process(new FailureContext(FailureType.CRITICAL_ERROR, ex)); throw new IgniteCheckedException("Failed to persist cache configuration: " + cacheData.config().getName(), ex); } }
@Override public boolean handle(Ignite ignite, FailureContext failureCtx) { if (failureCtx.type() == FailureType.SYSTEM_WORKER_BLOCKED) return false; return super.handle(ignite, failureCtx); } } :
/** {@inheritDoc} */ @Override public void finishRecover() throws IgniteCheckedException { try { for (CacheStoreHolder holder : idxCacheStores.values()) { holder.idxStore.finishRecover(); for (PageStore partStore : holder.partStores) partStore.finishRecover(); } } catch (StorageException e) { cctx.kernalContext().failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e)); throw e; } }
/** {@inheritDoc} */ @Override public boolean invalid() { FailureProcessor failureProc = failure(); return failureProc != null && failureProc.failureContext() != null && failureProc.failureContext().type() != FailureType.SEGMENTATION; }