/** * @throws Exception If failed. */ @Test public void testFailureHandlerTriggeredOnExchangeWorkerTermination() throws Exception { try { CountDownLatch latch = new CountDownLatch(1); TestFailureHandler hnd = new TestFailureHandler(false, latch); IgniteEx ignite = startGrid(getConfiguration().setFailureHandler(hnd)); GridCachePartitionExchangeManager<Object, Object> exchangeMgr = ignite.context().cache().context().exchange(); GridWorker exchangeWorker = GridTestUtils.getFieldValue(exchangeMgr, GridCachePartitionExchangeManager.class, "exchWorker"); assertNotNull(exchangeWorker); GridTestUtils.invoke(exchangeWorker, "addCustomTask", new ExchangeWorkerFailureTask()); assertTrue(latch.await(2000, TimeUnit.MILLISECONDS)); assertNotNull(hnd.failureCtx); assertEquals(hnd.failureCtx.type(), FailureType.SYSTEM_WORKER_TERMINATION); } finally { stopAllGrids(); } }