Skip to content

Commit 98295aa

Browse files
committed
Use ThreadPoolExecutor
1 parent b3cefe7 commit 98295aa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

logicaldoc-core/src/main/java/com/logicaldoc/core/threading/ThreadPools.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class ThreadPools {
4747

4848
private static final Logger log = LoggerFactory.getLogger(ThreadPools.class);
4949

50-
private Map<String, ExecutorService> pools = new HashMap<>();
50+
private Map<String, ThreadPoolExecutor> pools = new HashMap<>();
5151

5252
@Resource(name = "ContextProperties")
5353
protected ContextProperties config;
@@ -67,8 +67,8 @@ public static ThreadPools get() {
6767
* @throws ThreadPoolNotAvailableException Raised in case the pool has been
6868
* shutdown
6969
*/
70-
public synchronized ExecutorService getPool(String name) throws ThreadPoolNotAvailableException {
71-
ExecutorService pool = pools.get(name);
70+
public synchronized ThreadPoolExecutor getPool(String name) throws ThreadPoolNotAvailableException {
71+
ThreadPoolExecutor pool = pools.get(name);
7272

7373
if (pool != null) {
7474
if (pools.get(name).isShutdown())
@@ -142,7 +142,7 @@ public void execute(Runnable task, String poolName) {
142142
@PreDestroy
143143
public void shutdown() {
144144
log.info("Shutting down {} thread pools", pools.size());
145-
for (Map.Entry<String, ExecutorService> entry : pools.entrySet()) {
145+
for (Map.Entry<String, ThreadPoolExecutor> entry : pools.entrySet()) {
146146
log.info("Killing all the threads of pool {}", entry.getKey());
147147

148148
ExecutorService pool = entry.getValue();

0 commit comments

Comments
 (0)