use of org.apache.ignite.IgniteSystemProperties.IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT in project ignite by apache.
the class TransactionsMXBeanImplTest method testChangeLongOperationsDumpTimeoutOnImmutableCluster.
/**
* Test to verify the correct change of {@link TransactionsMXBean#getLongOperationsDumpTimeout()}
* in an immutable cluster.
*
* @throws Exception If failed.
*/
@Test
@WithSystemProperty(key = IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT, value = "100")
public void testChangeLongOperationsDumpTimeoutOnImmutableCluster() throws Exception {
Map<IgniteEx, TransactionsMXBean> allNodes = startGridAndActivate(2);
Map<IgniteEx, TransactionsMXBean> clientNodes = new HashMap<>();
Map<IgniteEx, TransactionsMXBean> srvNodes = new HashMap<>(allNodes);
clientNode = true;
for (int i = 2; i < 4; i++) {
IgniteEx igniteEx = startGrid(i);
TransactionsMXBean transactionsMXBean = txMXBean(i);
allNodes.put(igniteEx, transactionsMXBean);
clientNodes.put(igniteEx, transactionsMXBean);
}
// check for default value
checkPropertyValueViaTxMxBean(allNodes, 100L, TransactionsMXBean::getLongOperationsDumpTimeout);
// create property update latches for client nodes
Map<IgniteEx, List<CountDownLatch>> updateLatches = new HashMap<>();
clientNodes.keySet().forEach(ignite -> updateLatches.put(ignite, F.asList(new CountDownLatch(1), new CountDownLatch(1))));
clientNodes.forEach((igniteEx, bean) -> igniteEx.context().distributedMetastorage().listen((key) -> key.startsWith(DIST_CONF_PREFIX), (String key, Serializable oldVal, Serializable newVal) -> {
if ((long) newVal == 200)
updateLatches.get(igniteEx).get(0).countDown();
if ((long) newVal == 300)
updateLatches.get(igniteEx).get(1).countDown();
}));
long newTimeout = 200L;
// update value via server node
updatePropertyViaTxMxBean(allNodes, TransactionsMXBean::setLongOperationsDumpTimeout, newTimeout);
// check new value in server nodes
checkPropertyValueViaTxMxBean(srvNodes, newTimeout, TransactionsMXBean::getLongOperationsDumpTimeout);
// check new value in client nodes
for (List<CountDownLatch> list : updateLatches.values()) {
CountDownLatch countDownLatch = list.get(0);
countDownLatch.await(100, TimeUnit.MILLISECONDS);
}
newTimeout = 300L;
// update value via server node
updatePropertyViaTxMxBean(clientNodes, TransactionsMXBean::setLongOperationsDumpTimeout, newTimeout);
// check new value in server nodes
checkPropertyValueViaTxMxBean(srvNodes, newTimeout, TransactionsMXBean::getLongOperationsDumpTimeout);
// check new value on client nodes
for (List<CountDownLatch> list : updateLatches.values()) {
CountDownLatch countDownLatch = list.get(1);
countDownLatch.await(100, TimeUnit.MILLISECONDS);
}
}
Aggregations