Search in sources :

Example 86 with ScheduledThreadPoolExecutor

use of java.util.concurrent.ScheduledThreadPoolExecutor in project hazelcast by hazelcast.

the class Diagnostics method start.

public void start() {
    if (!enabled) {
        logger.finest("Diagnostics is disabled");
        return;
    }
    this.diagnosticsLogFile = new DiagnosticsLogFile(this);
    this.scheduler = new ScheduledThreadPoolExecutor(1, new DiagnosticSchedulerThreadFactory());
    logger.info("Diagnostics started");
}
Also used : ScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor)

Example 87 with ScheduledThreadPoolExecutor

use of java.util.concurrent.ScheduledThreadPoolExecutor in project storm by apache.

the class ShellSpout method open.

public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) {
    _collector = collector;
    _context = context;
    if (stormConf.containsKey(Config.TOPOLOGY_SUBPROCESS_TIMEOUT_SECS)) {
        workerTimeoutMills = 1000 * RT.intCast(stormConf.get(Config.TOPOLOGY_SUBPROCESS_TIMEOUT_SECS));
    } else {
        workerTimeoutMills = 1000 * RT.intCast(stormConf.get(Config.SUPERVISOR_WORKER_TIMEOUT_SECS));
    }
    _process = new ShellProcess(_command);
    if (!env.isEmpty()) {
        _process.setEnv(env);
    }
    Number subpid = _process.launch(stormConf, context, changeDirectory);
    LOG.info("Launched subprocess with pid " + subpid);
    heartBeatExecutorService = MoreExecutors.getExitingScheduledExecutorService(new ScheduledThreadPoolExecutor(1));
}
Also used : ShellProcess(org.apache.storm.utils.ShellProcess) ScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor)

Example 88 with ScheduledThreadPoolExecutor

use of java.util.concurrent.ScheduledThreadPoolExecutor in project hbase by apache.

the class Canary method main.

public static void main(String[] args) throws Exception {
    final Configuration conf = HBaseConfiguration.create();
    // loading the generic options to conf
    new GenericOptionsParser(conf, args);
    int numThreads = conf.getInt("hbase.canary.threads.num", MAX_THREADS_NUM);
    LOG.info("Number of execution threads " + numThreads);
    ExecutorService executor = new ScheduledThreadPoolExecutor(numThreads);
    Class<? extends Sink> sinkClass = conf.getClass("hbase.canary.sink.class", RegionServerStdOutSink.class, Sink.class);
    Sink sink = ReflectionUtils.newInstance(sinkClass);
    int exitCode = ToolRunner.run(conf, new Canary(executor, sink), args);
    executor.shutdown();
    System.exit(exitCode);
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) HBaseConfiguration(org.apache.hadoop.hbase.HBaseConfiguration) ScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor) ExecutorService(java.util.concurrent.ExecutorService) GenericOptionsParser(org.apache.hadoop.util.GenericOptionsParser)

Example 89 with ScheduledThreadPoolExecutor

use of java.util.concurrent.ScheduledThreadPoolExecutor in project hbase by apache.

the class TestHBaseFsckOneRS method setUpBeforeClass.

@BeforeClass
public static void setUpBeforeClass() throws Exception {
    TEST_UTIL.getConfiguration().set(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY, MasterSyncObserver.class.getName());
    conf.setInt("hbase.regionserver.handler.count", 2);
    conf.setInt("hbase.regionserver.metahandler.count", 30);
    conf.setInt("hbase.htable.threads.max", POOL_SIZE);
    conf.setInt("hbase.hconnection.threads.max", 2 * POOL_SIZE);
    conf.setInt("hbase.hbck.close.timeout", 2 * REGION_ONLINE_TIMEOUT);
    conf.setInt(HConstants.HBASE_RPC_TIMEOUT_KEY, 8 * REGION_ONLINE_TIMEOUT);
    TEST_UTIL.startMiniCluster(1);
    tableExecutorService = new ThreadPoolExecutor(1, POOL_SIZE, 60, TimeUnit.SECONDS, new SynchronousQueue<>(), Threads.newDaemonThreadFactory("testhbck"));
    hbfsckExecutorService = new ScheduledThreadPoolExecutor(POOL_SIZE);
    AssignmentManager assignmentManager = TEST_UTIL.getHBaseCluster().getMaster().getAssignmentManager();
    regionStates = assignmentManager.getRegionStates();
    connection = (ClusterConnection) TEST_UTIL.getConnection();
    admin = connection.getAdmin();
    admin.setBalancerRunning(false, true);
    TEST_UTIL.waitUntilAllRegionsAssigned(TableName.META_TABLE_NAME);
    TEST_UTIL.waitUntilAllRegionsAssigned(TableName.NAMESPACE_TABLE_NAME);
}
Also used : ScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor) SynchronousQueue(java.util.concurrent.SynchronousQueue) AssignmentManager(org.apache.hadoop.hbase.master.AssignmentManager) ScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) BeforeClass(org.junit.BeforeClass)

Example 90 with ScheduledThreadPoolExecutor

use of java.util.concurrent.ScheduledThreadPoolExecutor in project hbase by apache.

the class TestCanaryTool method runRegionserverCanary.

private void runRegionserverCanary() throws Exception {
    ExecutorService executor = new ScheduledThreadPoolExecutor(1);
    Canary canary = new Canary(executor, new Canary.RegionServerStdOutSink());
    String[] args = { "-t", "10000", "-regionserver" };
    ToolRunner.run(testingUtility.getConfiguration(), canary, args);
    assertEquals("verify no read error count", 0, canary.getReadFailures().size());
}
Also used : ScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor) ExecutorService(java.util.concurrent.ExecutorService)

Aggregations

ScheduledThreadPoolExecutor (java.util.concurrent.ScheduledThreadPoolExecutor)154 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)31 Test (org.junit.Test)26 ExecutorService (java.util.concurrent.ExecutorService)24 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)22 ThreadFactory (java.util.concurrent.ThreadFactory)15 Test (org.testng.annotations.Test)15 ArrayList (java.util.ArrayList)12 List (java.util.List)10 HashMap (java.util.HashMap)9 ServerInstance (com.linkedin.pinot.common.response.ServerInstance)8 NettyClientMetrics (com.linkedin.pinot.transport.metrics.NettyClientMetrics)8 MetricsRegistry (com.yammer.metrics.core.MetricsRegistry)8 NioEventLoopGroup (io.netty.channel.nio.NioEventLoopGroup)8 HashedWheelTimer (io.netty.util.HashedWheelTimer)8 File (java.io.File)8 CountDownLatch (java.util.concurrent.CountDownLatch)8 ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)7 IOException (java.io.IOException)7 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)7