Search in sources :

Example 1 with ConsoleThreadFactory

use of com.vip.saturn.job.console.utils.ConsoleThreadFactory in project Saturn by vipshop.

the class DashboardLeaderHandler method createNodeCache.

private void createNodeCache() throws Exception {
    executorService = Executors.newSingleThreadExecutor(new ConsoleThreadFactory("nodeCache-for-dashboardLeaderHost-" + zkAlias, false));
    nodeCache = new NodeCache(curatorFramework, SaturnSelfNodePath.SATURN_CONSOLE_DASHBOARD_LEADER_HOST);
    nodeCache.start();
    nodeCache.getListenable().addListener(new NodeCacheListener() {

        @Override
        public void nodeChanged() throws Exception {
            electLeaderIfNecessary();
        }
    }, executorService);
}
Also used : ConsoleThreadFactory(com.vip.saturn.job.console.utils.ConsoleThreadFactory) NodeCache(org.apache.curator.framework.recipes.cache.NodeCache) NodeCacheListener(org.apache.curator.framework.recipes.cache.NodeCacheListener)

Example 2 with ConsoleThreadFactory

use of com.vip.saturn.job.console.utils.ConsoleThreadFactory in project Saturn by vipshop.

the class DashboardLeaderTreeCache method createNodeCache.

private void createNodeCache() throws Exception {
    executorService = Executors.newSingleThreadExecutor(new ConsoleThreadFactory("nodeCache-for-dashboardLeaderHost-" + zkAlias, false));
    nodeCache = new NodeCache(curatorFramework, SaturnSelfNodePath.SATURN_CONSOLE_DASHBOARD_LEADER_HOST);
    nodeCache.start();
    nodeCache.getListenable().addListener(new NodeCacheListener() {

        @Override
        public void nodeChanged() throws Exception {
            electLeaderIfNecessary();
        }
    }, executorService);
}
Also used : ConsoleThreadFactory(com.vip.saturn.job.console.utils.ConsoleThreadFactory) NodeCache(org.apache.curator.framework.recipes.cache.NodeCache) NodeCacheListener(org.apache.curator.framework.recipes.cache.NodeCacheListener)

Example 3 with ConsoleThreadFactory

use of com.vip.saturn.job.console.utils.ConsoleThreadFactory in project Saturn by vipshop.

the class StatisticsRefreshServiceImpl method initStatExecutorService.

private void initStatExecutorService() {
    if (statExecutorService != null) {
        statExecutorService.shutdownNow();
    }
    ThreadPoolExecutor tp = new ThreadPoolExecutor(STAT_THREAD_NUM, STAT_THREAD_NUM, DashboardConstants.REFRESH_INTERVAL_IN_MINUTE + 1, TimeUnit.MINUTES, new LinkedBlockingQueue<Runnable>(), new ConsoleThreadFactory("dashboard-statistics-thread", true));
    tp.allowCoreThreadTimeOut(true);
    statExecutorService = tp;
}
Also used : ConsoleThreadFactory(com.vip.saturn.job.console.utils.ConsoleThreadFactory)

Aggregations

ConsoleThreadFactory (com.vip.saturn.job.console.utils.ConsoleThreadFactory)3 NodeCache (org.apache.curator.framework.recipes.cache.NodeCache)2 NodeCacheListener (org.apache.curator.framework.recipes.cache.NodeCacheListener)2