Best code examples for Java 8 ThreadPoolExecutor class (java.util.concurrent.ThreadPoolExecutor)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 ThreadPoolExecutor class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Java 8 ThreadPoolExecutor examples from Open Source projects
This code example shows how to use the following methods: execute, getActiveCount, getQueue, getTaskCount
71:	LOG.debug("Current active thread number: " + executor.getActiveCount() 
72:	+ " queue size:" + executor.getQueue().size() 
73:	+ " scheduled task number:" + executor.getTaskCount()); 
-
75:	executor.execute(task); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getQueue, isShutdown
40:	BlockingQueue<Runnable> queue = executor.getQueue(); 
-
54:	if (executor.isShutdown()) { 
-
57:	if (executor.getQueue() instanceof SizeBlockingQueue) { 
58:	sb.append("(queue capacity ").append(((SizeBlockingQueue) executor.getQueue()).capacity()).append(") "); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: allowCoreThreadTimeOut
87:	final ThreadPoolExecutor executorService = new ThreadPoolExecutor(POOL_CORE_SIZE, POOL_MAX_SIZE, 
-
91:	executorService.allowCoreThreadTimeOut(true); 
92:	getExecutorInjector().inject(executorService); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: awaitTermination, shutdown, shutdownNow
109:	executor.shutdown(); 
110:	if (!executor.awaitTermination(60, TimeUnit.SECONDS)) { 
111:	executor.shutdownNow(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getActiveCount, getPoolSize
51:	return executor.getPoolSize() - executor.getActiveCount(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setCorePoolSize
57:	scheduledExecutor.setCorePoolSize(maxThreads); 
-
60:	executor = new ManagedScheduledExecutorService(scheduledExecutor); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: awaitTermination, shutdown
59:	this.getExecutor.shutdown(); 
-
66:	this.getExecutor.awaitTermination(5000, TimeUnit.MILLISECONDS); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getActiveCount, getCompletedTaskCount, getCorePoolSize, getLargestPoolSize, getMaximumPoolSize
49:	threadName, e.getPoolSize(), e.getActiveCount(), e.getCorePoolSize(), e.getMaximumPoolSize(), e.getLargestPoolSize(), 
50:	e.getTaskCount(), e.getCompletedTaskCount(), e.isShutdown(), e.isTerminated(), e.isTerminating(), 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getQueue, isShutdown
39:	BlockingQueue<Runnable> queue = executor.getQueue(); 
-
54:	if (executor.isShutdown()) { 
-
57:	if (executor.getQueue() instanceof SizeBlockingQueue) { 
58:	sb.append("(queue capacity ").append(((SizeBlockingQueue) executor.getQueue()).capacity()).append(") "); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getActiveCount, getCompletedTaskCount, getCorePoolSize, getLargestPoolSize, getMaximumPoolSize
54:	long completed = executor.getCompletedTaskCount(); 
-
64:	now - last_change, executor.getCorePoolSize(), executor.getMaximumPoolSize(), 
65:	executor.getPoolSize(), executor.getActiveCount(), executor.getLargestPoolSize(), 
66:	executor.getCompletedTaskCount(), executor.getTaskCount()); 
-
74:	fallback.rejectedExecution(r, executor); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getActiveCount, getCompletedTaskCount, getCorePoolSize, getMaximumPoolSize, getPoolSize
34:	". activeCount=" + executor.getActiveCount() + 
35:	". corePoolSize=" + executor.getCorePoolSize() + 
36:	". poolSize=" + executor.getPoolSize() + 
37:	". maxPoolSize=" + executor.getMaximumPoolSize() + 
38:	". queueSize=" + executor.getQueue().size() + 
39:	". taskCount=" + executor.getTaskCount() + 
40:	". completedTaskCount=" + executor.getCompletedTaskCount() 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getActiveCount
246:	return this.threadPoolExecutor.getActiveCount(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getActiveCount, getMaximumPoolSize, getPoolSize, getQueue
111:	return tpe.getPoolSize() == tpe.getMaximumPoolSize() && 
112:	tpe.getQueue().size() >= tpe.getPoolSize() - tpe.getActiveCount(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getActiveCount, getCompletedTaskCount, getPoolSize, getQueue, getTaskCount
112:	threadPool.getActiveCount(), 
113:	threadPool.getPoolSize(), 
114:	threadPool.getTaskCount(), 
115:	threadPool.getCompletedTaskCount(), 
116:	threadPool.getQueue().size(), 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods:
36:	return new ThreadPoolExecutor(4, 4, 30L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(256), threadFactory); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getCompletedTaskCount
81:	return executor.getCompletedTaskCount(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getCorePoolSize, getKeepAliveTime, getMaximumPoolSize, getRejectedExecutionHandler
49:	assertEquals(1, tp.getCorePoolSize()); 
50:	assertEquals(5, tp.getMaximumPoolSize()); 
-
52:	assertEquals(60, tp.getKeepAliveTime(TimeUnit.SECONDS)); 
53:	assertEquals("CallerRuns", tp.getRejectedExecutionHandler().toString()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getCorePoolSize
147:	return threadPool.getCorePoolSize(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getActiveCount, getMaximumPoolSize, getPoolSize, getQueue
173:	return tpe.getPoolSize() == tpe.getMaximumPoolSize() && 
174:	tpe.getQueue().size() >= tpe.getPoolSize() - tpe.getActiveCount(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: allowCoreThreadTimeOut
139:	executor.allowCoreThreadTimeOut(true); 
-
166:	return new ThreadPoolExecutor(corePoolSize, maxPoolSize, 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getActiveCount, getMaximumPoolSize, getPoolSize, getQueue
173:	return tpe.getPoolSize() == tpe.getMaximumPoolSize() && 
174:	tpe.getQueue().size() >= tpe.getPoolSize() - tpe.getActiveCount(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: awaitTermination, shutdown, shutdownNow
113:	executor.shutdown(); 
114:	if (!executor.awaitTermination(60,TimeUnit.SECONDS)) 
115:	executor.shutdownNow(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getActiveCount, getCompletedTaskCount, getTaskCount
97:	sb.append(" \t| total: ").append(threadPool.getTaskCount()); 
-
99:	.append(threadPool.getCompletedTaskCount()); 
100:	sb.append(" \t| active: ").append(threadPool.getActiveCount()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods:
60:	return new ThreadPoolExecutor(4, 4, 30L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(256), threadFactory); 
Full Snippet Info
7
CodeRank
Related Java 8 ThreadPoolExecutor Questions & Answers:
See Code Examples for Java 8 ThreadPoolExecutor Methods: