1
0
mirror of https://github.com/sismics/docs.git synced 2025-12-14 18:26:17 +00:00

Closes #220: background tasks count

This commit is contained in:
Benjamin Gamard
2018-04-22 11:12:09 +02:00
parent dd1c06013b
commit 763f91fd4c
11 changed files with 74 additions and 43 deletions

View File

@@ -68,7 +68,7 @@ public class AppContext {
/**
* Asynchronous executors.
*/
private List<ExecutorService> asyncExecutorList;
private List<ThreadPoolExecutor> asyncExecutorList;
/**
* Start the application context.
@@ -181,6 +181,19 @@ public class AppContext {
}
}
/**
* Return the current number of queued tasks waiting to be processed.
*
* @return Number of queued tasks
*/
public int getQueuedTaskCount() {
int queueSize = 0;
for (ThreadPoolExecutor executor : asyncExecutorList) {
queueSize += executor.getQueue().size();
}
return queueSize;
}
public EventBus getAsyncEventBus() {
return asyncEventBus;
}