Search in sources :

Example 1 with StripedExecutorTaskView

use of org.apache.ignite.spi.systemview.view.StripedExecutorTaskView in project ignite by apache.

the class PoolProcessor method registerMetrics.

/**
 * Registers thread pools metrics and system views.
 */
public void registerMetrics() {
    monitorExecutor("GridUtilityCacheExecutor", utilityCacheExecSvc);
    monitorExecutor("GridExecutionExecutor", execSvc);
    monitorExecutor("GridServicesExecutor", svcExecSvc);
    monitorExecutor("GridSystemExecutor", sysExecSvc);
    monitorExecutor("GridClassLoadingExecutor", p2pExecSvc);
    monitorExecutor("GridManagementExecutor", mgmtExecSvc);
    monitorExecutor("GridAffinityExecutor", affExecSvc);
    monitorExecutor("GridCallbackExecutor", callbackExecSvc);
    monitorExecutor("GridQueryExecutor", qryExecSvc);
    monitorExecutor("GridSchemaExecutor", schemaExecSvc);
    monitorExecutor("GridRebalanceExecutor", rebalanceExecSvc);
    monitorExecutor("GridRebalanceStripedExecutor", rebalanceStripedExecSvc);
    monitorStripedPool("GridDataStreamExecutor", dataStreamerExecSvc);
    if (idxExecSvc != null)
        monitorExecutor("GridIndexingExecutor", idxExecSvc);
    if (ctx.config().getConnectorConfiguration() != null)
        monitorExecutor("GridRestExecutor", restExecSvc);
    if (stripedExecSvc != null) {
        // Striped executor uses a custom adapter.
        monitorStripedPool("StripedExecutor", stripedExecSvc);
    }
    if (snpExecSvc != null)
        monitorExecutor("GridSnapshotExecutor", snpExecSvc);
    if (thinClientExec != null)
        monitorExecutor("GridThinClientExecutor", thinClientExec);
    if (reencryptExecSvc != null)
        monitorExecutor("GridReencryptionExecutor", reencryptExecSvc);
    if (customExecs != null) {
        for (Map.Entry<String, ? extends ExecutorService> entry : customExecs.entrySet()) monitorExecutor(entry.getKey(), entry.getValue());
    }
    ctx.systemView().registerInnerCollectionView(SYS_POOL_QUEUE_VIEW, SYS_POOL_QUEUE_VIEW_DESC, new StripedExecutorTaskViewWalker(), Arrays.asList(stripedExecSvc.stripes()), StripedExecutor.Stripe::queue, StripedExecutorTaskView::new);
    ctx.systemView().registerInnerCollectionView(STREAM_POOL_QUEUE_VIEW, STREAM_POOL_QUEUE_VIEW_DESC, new StripedExecutorTaskViewWalker(), Arrays.asList(dataStreamerExecSvc.stripes()), StripedExecutor.Stripe::queue, StripedExecutorTaskView::new);
}
Also used : StripedExecutorTaskView(org.apache.ignite.spi.systemview.view.StripedExecutorTaskView) Map(java.util.Map) HashMap(java.util.HashMap) StripedExecutorTaskViewWalker(org.apache.ignite.internal.managers.systemview.walker.StripedExecutorTaskViewWalker)

Example 2 with StripedExecutorTaskView

use of org.apache.ignite.spi.systemview.view.StripedExecutorTaskView in project ignite by apache.

the class SystemViewSelfTest method checkStripeExecutorView.

/**
 * Checks striped executor system view.
 *
 * @param execSvc Striped executor.
 * @param view System view.
 * @param poolName Executor name.
 */
private void checkStripeExecutorView(StripedExecutor execSvc, SystemView<StripedExecutorTaskView> 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(() -> view.size() == 2, 5_000);
        assertTrue(res);
        Iterator<StripedExecutorTaskView> iter = view.iterator();
        assertTrue(iter.hasNext());
        StripedExecutorTaskView row0 = iter.next();
        assertEquals(0, row0.stripeIndex());
        assertEquals(TestRunnable.class.getSimpleName() + '1', row0.description());
        assertEquals(poolName + "-stripe-0", row0.threadName());
        assertEquals(TestRunnable.class.getName(), row0.taskName());
        assertTrue(iter.hasNext());
        StripedExecutorTaskView row1 = iter.next();
        assertEquals(1, row1.stripeIndex());
        assertEquals(TestRunnable.class.getSimpleName() + '3', row1.description());
        assertEquals(poolName + "-stripe-1", row1.threadName());
        assertEquals(TestRunnable.class.getName(), row1.taskName());
    } finally {
        latch.countDown();
    }
}
Also used : StripedExecutorTaskView(org.apache.ignite.spi.systemview.view.StripedExecutorTaskView) CountDownLatch(java.util.concurrent.CountDownLatch) IgniteCountDownLatch(org.apache.ignite.IgniteCountDownLatch)

Aggregations

StripedExecutorTaskView (org.apache.ignite.spi.systemview.view.StripedExecutorTaskView)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 IgniteCountDownLatch (org.apache.ignite.IgniteCountDownLatch)1 StripedExecutorTaskViewWalker (org.apache.ignite.internal.managers.systemview.walker.StripedExecutorTaskViewWalker)1