Reputation: 21
My apache ignite application is built with springboot. Here is my application flow.
Below is my code.
ignite.message(ReceiverNode).remoteListen(topic, (nodeId, message) -> {
doSomething();
ignite.message(ignite.cluster().forNodeId(nodeId)).send(topic, reply);
return false;
});
ignite.message().localListen(null, (nodeId, message) -> {
if(message is terminate sign) {
context.close(); // springcontext
return false;
} else {
return true;
}
});
ignite.message(ReceiverNode).send(message, args);
But after SenderNode receiving terminate sign and closing spring context, ignite node is not terminated.
Is there any way to do this? thnx.
Upvotes: 0
Views: 271
Reputation: 3591
You should close an Ignite instance to stop its work. But I think, you'll get a deadlock if you try to shut down Ignite from the message listener.
Try doing it from a separate thread. Put the following code to the listener:
new Thread(ignite::close).start()
If Ignite is a part of the Spring context, then closing of the context will be enough:
new Thread(context::close).start()
Upvotes: 1