当前位置: 首页>>代码示例>>Java>>正文


Java JMXEnabledThreadPoolExecutor.getPendingTasks方法代码示例

本文整理汇总了Java中org.apache.cassandra.concurrent.JMXEnabledThreadPoolExecutor.getPendingTasks方法的典型用法代码示例。如果您正苦于以下问题:Java JMXEnabledThreadPoolExecutor.getPendingTasks方法的具体用法?Java JMXEnabledThreadPoolExecutor.getPendingTasks怎么用?Java JMXEnabledThreadPoolExecutor.getPendingTasks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cassandra.concurrent.JMXEnabledThreadPoolExecutor的用法示例。


在下文中一共展示了JMXEnabledThreadPoolExecutor.getPendingTasks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: waitForGossipToSettle

import org.apache.cassandra.concurrent.JMXEnabledThreadPoolExecutor; //导入方法依赖的package包/类
private void waitForGossipToSettle()
{
    int forceAfter = Integer.getInteger("cassandra.skip_wait_for_gossip_to_settle", -1);
    if (forceAfter == 0)
    {
        return;
    }
    final int GOSSIP_SETTLE_MIN_WAIT_MS = 5000;
    final int GOSSIP_SETTLE_POLL_INTERVAL_MS = 1000;
    final int GOSSIP_SETTLE_POLL_SUCCESSES_REQUIRED = 3;

    logger.info("Waiting for gossip to settle before accepting client requests...");
    Uninterruptibles.sleepUninterruptibly(GOSSIP_SETTLE_MIN_WAIT_MS, TimeUnit.MILLISECONDS);
    int totalPolls = 0;
    int numOkay = 0;
    JMXEnabledThreadPoolExecutor gossipStage = (JMXEnabledThreadPoolExecutor)StageManager.getStage(Stage.GOSSIP);
    while (numOkay < GOSSIP_SETTLE_POLL_SUCCESSES_REQUIRED)
    {
        Uninterruptibles.sleepUninterruptibly(GOSSIP_SETTLE_POLL_INTERVAL_MS, TimeUnit.MILLISECONDS);
        long completed = gossipStage.getCompletedTasks();
        long active = gossipStage.getActiveCount();
        long pending = gossipStage.getPendingTasks();
        totalPolls++;
        if (active == 0 && pending == 0)
        {
            logger.debug("Gossip looks settled. CompletedTasks: {}", completed);
            numOkay++;
        }
        else
        {
            logger.info("Gossip not settled after {} polls. Gossip Stage active/pending/completed: {}/{}/{}", totalPolls, active, pending, completed);
            numOkay = 0;
        }
        if (forceAfter > 0 && totalPolls > forceAfter)
        {
            logger.warn("Gossip not settled but startup forced by cassandra.skip_wait_for_gossip_to_settle. Gossip Stage total/active/pending/completed: {}/{}/{}/{}",
                        totalPolls, active, pending, completed);
            break;
        }
    }
    if (totalPolls > GOSSIP_SETTLE_POLL_SUCCESSES_REQUIRED)
        logger.info("Gossip settled after {} extra polls; proceeding", totalPolls - GOSSIP_SETTLE_POLL_SUCCESSES_REQUIRED);
    else
        logger.info("No gossip backlog; proceeding");
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:46,代码来源:CassandraDaemon.java

示例2: waitForGossipToSettle

import org.apache.cassandra.concurrent.JMXEnabledThreadPoolExecutor; //导入方法依赖的package包/类
private void waitForGossipToSettle()
{
    int forceAfter = Integer.getInteger("cassandra.skip_wait_for_gossip_to_settle", -1);
    if (forceAfter == 0)
    {
        return;
    }
    final int GOSSIP_SETTLE_MIN_WAIT_MS = 5000;
    final int GOSSIP_SETTLE_POLL_INTERVAL_MS = 1000;
    final int GOSSIP_SETTLE_POLL_SUCCESSES_REQUIRED = 3;

    logger.info("waiting for gossip to settle before accepting client requests...");
    Uninterruptibles.sleepUninterruptibly(GOSSIP_SETTLE_MIN_WAIT_MS, TimeUnit.MILLISECONDS);
    int totalPolls = 0;
    int numOkay = 0;
    JMXEnabledThreadPoolExecutor gossipStage = (JMXEnabledThreadPoolExecutor)StageManager.getStage(Stage.GOSSIP);
    while (numOkay < GOSSIP_SETTLE_POLL_SUCCESSES_REQUIRED)
    {
        Uninterruptibles.sleepUninterruptibly(GOSSIP_SETTLE_POLL_INTERVAL_MS, TimeUnit.MILLISECONDS);
        long completed = gossipStage.getCompletedTasks();
        long active = gossipStage.getActiveCount();
        long pending = gossipStage.getPendingTasks();
        totalPolls++;
        if (active == 0 && pending == 0)
        {
            logger.debug("gossip looks settled. CompletedTasks: {}", completed);
            numOkay++;
        }
        else
        {
            logger.info("gossip not settled after {} polls. Gossip Stage active/pending/completed: {}/{}/{}", totalPolls, active, pending, completed);
            numOkay = 0;
        }
        if (forceAfter > 0 && totalPolls > forceAfter)
        {
            logger.warn("Gossip not settled but startup forced by cassandra.skip_wait_for_gossip_to_settle. Gossip Stage total/active/pending/completed: {}/{}/{}/{}",
                        totalPolls, active, pending, completed);
            break;
        }
    }
    logger.info("gossip settled after {} extra polls; proceeding", totalPolls - GOSSIP_SETTLE_POLL_SUCCESSES_REQUIRED);
}
 
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:43,代码来源:CassandraDaemon.java


注:本文中的org.apache.cassandra.concurrent.JMXEnabledThreadPoolExecutor.getPendingTasks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。