ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djm132 <dobermann...@gmail.com>
Subject Graceful shutdown
Date Thu, 12 May 2016 17:33:07 GMT

I've implemented grid task workers and what to shutdown them gracefully
(after finishing all active tasks). I see there is ignite.close() method
which can be broadcasted to remote nodes.

One of solution I've got from another thread looks now like this:

    static class PoisonPill implements IgniteRunnable {
        private transient Ignite ignite;

        public void run() {
            new Thread() {
                @Override public void run() {

    // Called from http API
    public static void shutdownCluster() {
        // Stop remote servers if connected
        ClusterGroup remotes = instance.ignite.cluster().forRemotes();
        if (remotes.nodes().size() > 0) {
            instance.ignite.compute(remotes).broadcast(new PoisonPill());

        // Close this instance

This code works fine, but I only if there is no active tasks on node. If
there is some task executing, I am receiving this:

2016/05/12 20:45:35.959 [http-2] WARN Will cancel unfinished tasks due to
stopping of the grid [cnt=1]
[20:45:35] (err) Failed to notify listener:
org.apache.ignite.compute.ComputeTaskCancelledException: Task cancelled due
to stopping of the grid....

May be there is a way to correctly write tasks and checking for termination


View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Graceful-shutdown-tp4911.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

View raw message