use of org.apache.ignite.internal.worker.WorkersRegistry in project ignite by apache.
the class FailureHandlingConfigurationTest method testOverridingBySysProps.
/**
* @throws Exception If failed.
*/
@Test
@WithSystemProperty(key = IGNITE_SYSTEM_WORKER_BLOCKED_TIMEOUT, value = "80000")
@WithSystemProperty(key = IGNITE_CHECKPOINT_READ_LOCK_TIMEOUT, value = "90000")
public void testOverridingBySysProps() throws Exception {
sysWorkerBlockedTimeout = 1L;
checkpointReadLockTimeout = 2L;
IgniteEx ignite = startGrid(0);
ignite.cluster().active(true);
WorkersRegistry reg = ignite.context().workersRegistry();
IgniteCacheDatabaseSharedManager dbMgr = ignite.context().cache().context().database();
FailureHandlingMxBean mBean = getMBean();
assertEquals(sysWorkerBlockedTimeout, ignite.configuration().getSystemWorkerBlockedTimeout());
assertEquals(checkpointReadLockTimeout, ignite.configuration().getDataStorageConfiguration().getCheckpointReadLockTimeout());
long workerPropVal = Long.getLong(IGNITE_SYSTEM_WORKER_BLOCKED_TIMEOUT);
long checkpointPropVal = Long.getLong(IGNITE_CHECKPOINT_READ_LOCK_TIMEOUT);
assertEquals(workerPropVal, reg.getSystemWorkerBlockedTimeout());
assertEquals(checkpointPropVal, dbMgr.checkpointReadLockTimeout());
assertEquals(workerPropVal, mBean.getSystemWorkerBlockedTimeout());
assertEquals(checkpointPropVal, mBean.getCheckpointReadLockTimeout());
}
use of org.apache.ignite.internal.worker.WorkersRegistry in project ignite by apache.
the class FailureHandlingConfigurationTest method testNegativeParamValues.
/**
* @throws Exception If failed.
*/
@Test
public void testNegativeParamValues() throws Exception {
sysWorkerBlockedTimeout = -1L;
checkpointReadLockTimeout = -85L;
IgniteEx ignite = startGrid(0);
ignite.cluster().active(true);
WorkersRegistry reg = ignite.context().workersRegistry();
IgniteCacheDatabaseSharedManager dbMgr = ignite.context().cache().context().database();
FailureHandlingMxBean mBean = getMBean();
assertEquals(0L, reg.getSystemWorkerBlockedTimeout());
assertEquals(-85L, dbMgr.checkpointReadLockTimeout());
assertEquals(0L, mBean.getSystemWorkerBlockedTimeout());
assertEquals(-85L, mBean.getCheckpointReadLockTimeout());
}
use of org.apache.ignite.internal.worker.WorkersRegistry in project ignite by apache.
the class SystemWorkersBlockingTest method testBlockingWorker.
/**
* @throws Exception If failed.
*/
@Test
public void testBlockingWorker() throws Exception {
IgniteEx ignite = startGrid(0);
GridWorker worker = new LatchingGridWorker(ignite);
runWorker(worker);
ignite.context().workersRegistry().register(worker);
assertTrue(hndLatch.await(ignite.configuration().getFailureDetectionTimeout() * 2, TimeUnit.MILLISECONDS));
Throwable blockedExeption = failureError.get();
assertNotNull(blockedExeption);
assertTrue(Arrays.stream(blockedExeption.getStackTrace()).anyMatch(e -> CountDownLatch.class.getName().equals(e.getClassName())));
assertTrue(Arrays.stream(blockedExeption.getStackTrace()).anyMatch(e -> LatchingGridWorker.class.getName().equals(e.getClassName())));
}
use of org.apache.ignite.internal.worker.WorkersRegistry in project ignite by apache.
the class SystemWorkersTerminationTest method testSyntheticWorkerTermination.
/**
* @throws Exception If failed.
*/
@Test
public void testSyntheticWorkerTermination() throws Exception {
IgniteEx ignite = grid(0);
WorkersRegistry registry = ignite.context().workersRegistry();
long fdTimeout = ignite.configuration().getFailureDetectionTimeout();
GridWorker worker = new GridWorker(ignite.name(), "test-worker", log, registry) {
@Override
protected void body() throws InterruptedException {
Thread.sleep(fdTimeout / 2);
}
};
IgniteThread thread = new IgniteThread(worker);
failureHndThreadName = null;
thread.start();
thread.join();
assertTrue(GridTestUtils.waitForCondition(() -> thread.getName().equals(failureHndThreadName), fdTimeout * 2));
}
Aggregations