/** * @param c Closure to run. */ void runInWorkerThread(Runnable c) { IgniteThreadPoolExecutor pool; synchronized (stateMux) { if (connState == ConnectionState.STOPPED) { LT.warn(log, "Do not run closure, node is stopped."); return; } if (utilityPool == null) { utilityPool = new IgniteThreadPoolExecutor("zk-discovery-pool", igniteInstanceName, 0, 1, 2000, new LinkedBlockingQueue<Runnable>()); } pool = utilityPool; } pool.submit(c); }
/** * @param prestart Prestart flag. */ public void startThreads(boolean prestart) { execSvc = new IgniteThreadPoolExecutor(nodeId.toString(), null, 40, 40, Long.MAX_VALUE, new LinkedBlockingQueue<Runnable>()); // Improve concurrency for testing. if (prestart) execSvc.prestartAllCoreThreads(); }
final CountDownLatch stopLatch = new CountDownLatch(THREAD_CNT); IgniteThreadPoolExecutor exec = new IgniteThreadPoolExecutor( THREAD_CNT, THREAD_CNT, Long.MAX_VALUE, new LinkedBlockingQueue<Runnable>(),
/** * @throws ExecutionException If failed. */ @Test public void testGridThreadPoolExecutorRejection() throws Exception { IgniteThreadPoolExecutor exec = new IgniteThreadPoolExecutor("", "", 1, 1, 0, new LinkedBlockingQueue<Runnable>()); for (int i = 0; i < 10; i++) exec.submit(new TestRunnable()); exec.shutdown(); assert exec.awaitTermination(30, SECONDS); }
/** * @throws ExecutionException If failed. */ @Test public void testGridThreadPoolExecutor() throws Exception { IgniteThreadPoolExecutor exec = new IgniteThreadPoolExecutor("", "", 1, 1, 0, new LinkedBlockingQueue<Runnable>()); exec.submit(new InterruptingRunnable()).get(); Future<Boolean> fut = exec.submit(new IsInterruptedAssertionCallable()); assert !fut.get() : "Expecting the executor to reset the interrupted flag when reinvoking the thread"; exec.shutdown(); assert exec.awaitTermination(30, SECONDS); }
/** * Constructs IGFS IPC handler. * * @param igfsCtx Context. * @param endpointCfg Endpoint configuration. * @param mgmt Management flag. */ IgfsIpcHandler(IgfsContext igfsCtx, IgfsIpcEndpointConfiguration endpointCfg, boolean mgmt) { assert igfsCtx != null; ctx = igfsCtx.kernalContext(); igfs = igfsCtx.igfs(); // Keep buffer size multiple of block size so no extra byte array copies is performed. bufSize = igfsCtx.configuration().getBlockSize() * 2; // Create thread pool for request handling. int threadCnt = endpointCfg.getThreadCount(); String prefix = "igfs-" + igfsCtx.igfs().name() + (mgmt ? "mgmt-" : "") + "-ipc"; pool = new IgniteThreadPoolExecutor(prefix, igfsCtx.kernalContext().igniteInstanceName(), threadCnt, threadCnt, Long.MAX_VALUE, new LinkedBlockingQueue<Runnable>()); log = ctx.log(IgfsIpcHandler.class); }
dualPool = secondaryFs != null ? new IgniteThreadPoolExecutor(4, Integer.MAX_VALUE, 5000L, new SynchronousQueue<Runnable>(), new IgfsThreadFactory(cfg.getName())) : null;
execSvc = new IgniteThreadPoolExecutor( "pub", cfg.getIgniteInstanceName(), svcExecSvc = new IgniteThreadPoolExecutor( "svc", cfg.getGridName(), sysExecSvc = new IgniteThreadPoolExecutor( "sys", cfg.getIgniteInstanceName(), mgmtExecSvc = new IgniteThreadPoolExecutor( "mgmt", cfg.getIgniteInstanceName(), p2pExecSvc = new IgniteThreadPoolExecutor( "p2p", cfg.getIgniteInstanceName(), igfsExecSvc = new IgniteThreadPoolExecutor( cfg.getIgfsThreadPoolSize(), cfg.getIgfsThreadPoolSize(), restExecSvc = new IgniteThreadPoolExecutor( "rest", myCfg.getIgniteInstanceName(), utilityCacheExecSvc = new IgniteThreadPoolExecutor(
utilityPool = new IgniteThreadPoolExecutor("disco-pool", spi.ignite().name(), 0,
exec = new IgniteThreadPoolExecutor( "auth", ctx.config().getIgniteInstanceName(),
execSvc = new IgniteThreadPoolExecutor( "client-connector", cfg.getIgniteInstanceName(),
/** * Constructs IGFS IPC handler. * * @param igfsCtx Context. * @param endpointCfg Endpoint configuration. * @param mgmt Management flag. */ IgfsIpcHandler(IgfsContext igfsCtx, IgfsIpcEndpointConfiguration endpointCfg, boolean mgmt) { assert igfsCtx != null; ctx = igfsCtx.kernalContext(); igfs = igfsCtx.igfs(); // Keep buffer size multiple of block size so no extra byte array copies is performed. bufSize = igfsCtx.configuration().getBlockSize() * 2; // Create thread pool for request handling. int threadCnt = endpointCfg.getThreadCount(); String prefix = "igfs-" + igfsCtx.igfs().name() + (mgmt ? "mgmt-" : "") + "-ipc"; pool = new IgniteThreadPoolExecutor(prefix, igfsCtx.kernalContext().igniteInstanceName(), threadCnt, threadCnt, Long.MAX_VALUE, new LinkedBlockingQueue<Runnable>()); log = ctx.log(IgfsIpcHandler.class); }
dualPool = secondaryFs != null ? new IgniteThreadPoolExecutor(4, Integer.MAX_VALUE, 5000L, new SynchronousQueue<Runnable>(), new IgfsThreadFactory(cfg.getName())) : null;
execSvc = new IgniteThreadPoolExecutor( "pub", cfg.getIgniteInstanceName(), svcExecSvc = new IgniteThreadPoolExecutor( "svc", cfg.getGridName(), sysExecSvc = new IgniteThreadPoolExecutor( "sys", cfg.getIgniteInstanceName(), mgmtExecSvc = new IgniteThreadPoolExecutor( "mgmt", cfg.getIgniteInstanceName(), p2pExecSvc = new IgniteThreadPoolExecutor( "p2p", cfg.getIgniteInstanceName(), igfsExecSvc = new IgniteThreadPoolExecutor( cfg.getIgfsThreadPoolSize(), cfg.getIgfsThreadPoolSize(), restExecSvc = new IgniteThreadPoolExecutor( "rest", myCfg.getIgniteInstanceName(), utilityCacheExecSvc = new IgniteThreadPoolExecutor(
utilityPool = new IgniteThreadPoolExecutor("disco-pool", spi.ignite().name(), 0,
exec = new IgniteThreadPoolExecutor( "auth", ctx.config().getIgniteInstanceName(),
execSvc = new IgniteThreadPoolExecutor( "client-connector", cfg.getIgniteInstanceName(),