use of org.apache.ignite.internal.metric.SystemViewSelfTest.TestRunnable in project ignite by apache.
the class JmxExporterSpiTest method checkStripeExecutorView.
/**
* Checks striped executor system view.
*
* @param execSvc Striped executor.
* @param viewName System view.
* @param poolName Executor name.
*/
private void checkStripeExecutorView(StripedExecutor execSvc, String viewName, String poolName) throws Exception {
CountDownLatch latch = new CountDownLatch(1);
execSvc.execute(0, new TestRunnable(latch, 0));
execSvc.execute(0, new TestRunnable(latch, 1));
execSvc.execute(1, new TestRunnable(latch, 2));
execSvc.execute(1, new TestRunnable(latch, 3));
try {
boolean res = waitForCondition(() -> systemView(viewName).size() == 2, 5_000);
assertTrue(res);
TabularDataSupport view = systemView(viewName);
CompositeData row0 = view.get(new Object[] { 0 });
assertEquals(0, row0.get("stripeIndex"));
assertEquals(TestRunnable.class.getSimpleName() + '1', row0.get("description"));
assertEquals(poolName + "-stripe-0", row0.get("threadName"));
assertEquals(TestRunnable.class.getName(), row0.get("taskName"));
CompositeData row1 = view.get(new Object[] { 1 });
assertEquals(1, row1.get("stripeIndex"));
assertEquals(TestRunnable.class.getSimpleName() + '3', row1.get("description"));
assertEquals(poolName + "-stripe-1", row1.get("threadName"));
assertEquals(TestRunnable.class.getName(), row1.get("taskName"));
} finally {
latch.countDown();
}
}
use of org.apache.ignite.internal.metric.SystemViewSelfTest.TestRunnable in project ignite by apache.
the class SqlViewExporterSpiTest method checkStripeExecutorView.
/**
* Checks striped executor system view.
*
* @param execSvc Striped executor.
* @param view System view name.
* @param poolName Executor name.
*/
private void checkStripeExecutorView(StripedExecutor execSvc, String view, String poolName) throws Exception {
CountDownLatch latch = new CountDownLatch(1);
execSvc.execute(0, new TestRunnable(latch, 0));
execSvc.execute(0, new TestRunnable(latch, 1));
execSvc.execute(1, new TestRunnable(latch, 2));
execSvc.execute(1, new TestRunnable(latch, 3));
try {
boolean res = waitForCondition(() -> execute(ignite0, "SELECT * FROM SYS." + view).size() == 2, 5_000);
assertTrue(res);
List<List<?>> stripedQueue = execute(ignite0, "SELECT * FROM SYS." + view);
List<?> row0 = stripedQueue.get(0);
assertEquals(0, row0.get(0));
assertEquals(TestRunnable.class.getSimpleName() + '1', row0.get(1));
assertEquals(poolName + "-stripe-0", row0.get(2));
assertEquals(TestRunnable.class.getName(), row0.get(3));
List<?> row1 = stripedQueue.get(1);
assertEquals(1, row1.get(0));
assertEquals(TestRunnable.class.getSimpleName() + '3', row1.get(1));
assertEquals(poolName + "-stripe-1", row1.get(2));
assertEquals(TestRunnable.class.getName(), row1.get(3));
} finally {
latch.countDown();
}
}
use of org.apache.ignite.internal.metric.SystemViewSelfTest.TestRunnable in project ignite by apache.
the class SystemViewCommandTest method checkStripeExecutorView.
/**
* Checks striped executor system view.
*
* @param execSvc Striped executor.
* @param view System view name.
* @param poolName Executor name.
*/
private void checkStripeExecutorView(StripedExecutor execSvc, String view, String poolName) throws Exception {
CountDownLatch latch = new CountDownLatch(1);
execSvc.execute(0, new TestRunnable(latch, 0));
execSvc.execute(0, new TestRunnable(latch, 1));
execSvc.execute(1, new TestRunnable(latch, 2));
execSvc.execute(1, new TestRunnable(latch, 3));
try {
assertTrue(waitForCondition(() -> systemView(ignite0, view).size() == 2, getTestTimeout()));
List<List<String>> stripedQueue = systemView(ignite0, view);
List<String> row0 = stripedQueue.get(0);
assertEquals("0", row0.get(0));
assertEquals(TestRunnable.class.getSimpleName() + '1', row0.get(1));
assertEquals(poolName + "-stripe-0", row0.get(2));
assertEquals(TestRunnable.class.getName(), row0.get(3));
List<String> row1 = stripedQueue.get(1);
assertEquals("1", row1.get(0));
assertEquals(TestRunnable.class.getSimpleName() + '3', row1.get(1));
assertEquals(poolName + "-stripe-1", row1.get(2));
assertEquals(TestRunnable.class.getName(), row1.get(3));
} finally {
latch.countDown();
}
}
Aggregations