ThreadPoolExecutor in AEM
hi
can you share examples of how to use ThreadPoolExecutor in AEM along with Apache sling thread pool configuration (in configMgr), I guess these two goes together ?
Thank you
hi
can you share examples of how to use ThreadPoolExecutor in AEM along with Apache sling thread pool configuration (in configMgr), I guess these two goes together ?
Thank you
Hi @nbg19a
I am not sure if you can change the thread pool for OOTB features, I have not seen any configuration for that.
There are configuration for sling queue, replication queues, there you can use custom thread pool.
I think below code can help?
@Reference
ThreadPoolManager threadPoolManager;
ThreadPool myThreadPool;
@Activate
public void activate() {
myThreadPool = threadPoolManager.get("my-thread-pool");
}
@Deactivate
public void deactivate() {
threadPoolManager.release(myThreadPool);
}
public void doSomething() {
myThreadPool.execute (() -> {
// submit a runnable to this threadpool
});
}Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.