Search code examples
executorservicehazelcastshutdownexecutor

shut down local client of hazelcast exector service


We are using a hazelcast executor service to distribute tasks across our cluster of servers.

We want to shut down one of our servers and take it out of the cluster but allow it to continue working for a period to finish what it is doing but not accept any new tasks from the hazelcast executor service.

I don't want to shut down the hazelcast instance because the current tasks may need it to complete their work.

Shutting down the hazelcast executor service is not what I want. That shuts down the executor cluster-wide.

I would like to continue processing the tasks in the local queue until it is empty and then shut down.

Is there a way for me to let a node in the cluster continue to use hazelcast but tell it to stop accepting new tasks from the executor service?


Solution

  • Not that easily, however you have member attributes (Member::setX/::getX) and you could set an attribute to signal "no new tasks please" and when you submit a tasks you either preselect a member to execute on based on the attribute or you use the overload with the MemberSelector.