I am using Hazelcast IExecutor Service.
I've written test where I submit task to IExecutorService, while executor service thread is still under execution, JVM is getting terminated and hence Hazelcast Shutdown occurs. Hence, test is failing.
Is there any way where I can prevent JVM or test termination while hazelcast thread is still under execution?
CodePudding user response:
The Javadoc on getExecutorService says there is no defined shutdown behavior:
Note: Note that it doesn't support invokeAll/Any and doesn't have standard shutdown behavior
Unfortunately, there is no way to change that. You can look into the implementation details in ExecutionServiceImpl class where you can see it waits for 3 seconds to finish before shutting down the executor. Beware that this can be changed anytime. We are actually looking into making this behavior more defined and maybe even configurable.
Feel free to file a feature request at GitHub, especially if you shutdown gracefully/terminate, if you access cluster data in the task and what is your expectation if your task takes too long to finish.