Search code examples
javahazelcastexecutorservicethreadpoolexecutorexecutor

Is there a way to use custom executor in Hazelcast?


It is possible to configure custom executor using ExecutorConfig, e.g.:

Config config = new Config();
config.getExecutorConfig("my-custom-executor").setPoolSize(40).setName("my-executor");

This will finally create some java.util.concurrent.ThreadPoolExecutor child.

But how can I specify customly created java.util.concurrent.ExecutorService implementation as some named executor in Hazelcast?


Solution

  • Creating a custom j.u.c.ExecutorService managed by Hazelcast is not possible at the moment (current latest GA version is 3.12.5 and 4.0 is about to be released). All executors share the same cached thread-pool using separate task queues per custom executor (see CachedExecutorServiceDelegate). And this shared thread pool is an instance of j.u.c.ThreadPoolExecutor.

    I think it should be fairly easy to add this as a new feature. You can create an issue at Issue Tracker or better send a pull request with an implementation.