mirror of
https://github.com/sismics/docs.git
synced 2024-11-22 05:57:57 +01:00
#400: limit async bus to (cpu cores / 2) threads
This commit is contained in:
parent
fda13c004e
commit
3ec254e908
@ -5,7 +5,6 @@ import com.google.common.eventbus.AsyncEventBus;
|
|||||||
import com.google.common.eventbus.EventBus;
|
import com.google.common.eventbus.EventBus;
|
||||||
import com.sismics.docs.core.constant.Constants;
|
import com.sismics.docs.core.constant.Constants;
|
||||||
import com.sismics.docs.core.dao.UserDao;
|
import com.sismics.docs.core.dao.UserDao;
|
||||||
import com.sismics.docs.core.event.RebuildIndexAsyncEvent;
|
|
||||||
import com.sismics.docs.core.listener.async.*;
|
import com.sismics.docs.core.listener.async.*;
|
||||||
import com.sismics.docs.core.model.jpa.User;
|
import com.sismics.docs.core.model.jpa.User;
|
||||||
import com.sismics.docs.core.service.FileService;
|
import com.sismics.docs.core.service.FileService;
|
||||||
@ -172,7 +171,8 @@ public class AppContext {
|
|||||||
if (EnvironmentUtil.isUnitTest()) {
|
if (EnvironmentUtil.isUnitTest()) {
|
||||||
return new EventBus();
|
return new EventBus();
|
||||||
} else {
|
} else {
|
||||||
ThreadPoolExecutor executor = new ThreadPoolExecutor(8, 8,
|
int threadCount = Runtime.getRuntime().availableProcessors() / 2;
|
||||||
|
ThreadPoolExecutor executor = new ThreadPoolExecutor(threadCount, threadCount,
|
||||||
1L, TimeUnit.MINUTES,
|
1L, TimeUnit.MINUTES,
|
||||||
new LinkedBlockingQueue<>());
|
new LinkedBlockingQueue<>());
|
||||||
asyncExecutorList.add(executor);
|
asyncExecutorList.add(executor);
|
||||||
|
Loading…
Reference in New Issue
Block a user