Is there a way to use a custom executor in Hazelcast?
Custom executors can be configured using ExecutorConfig
, for example:
Config config = new Config();
config.getExecutorConfig("my-custom-executor").setPoolSize(40).setName("my-executor");
This eventually creates some java.util.concurrent.ThreadPoolExecutor
child objects.
But how can I specify the custom-created java.util.concurrent.ExecutorService
implementation as some named executor in Hazelcast?
Solution
It is currently not possible to create a custom j.u.c.ExecutorService
managed by Hazelcast (the current latest GA versions are 3.12.5 and 4.0 coming soon). All executors share the same cache thread pool using a separate task queue for each custom executor (see CachedExecutorServiceDelegate )。 This shared thread pool is an instance of j.u.c. ThreadPoolExecutor.
I think it should be fairly easy to add it as a new feature. You can create an issue in Issue Tracker or better yet, send a pull request with an implementation.