Perfect ! Thanks a lot.
Cheers, p On Wed, Sep 30, 2015 at 5:39 PM, Anton Vinogradov <avinogra...@gridgain.com> wrote: > Hello, > > Please try > > grid.compute(grid.cluster().forRemotes()).broadcast(new PoisonPill()); > > and > > static class PoisonPill implements IgniteRunnable { > @IgniteInstanceResource > private transient Ignite ignite; > > @Override > public void run() { > new Thread() { > @Override public void run() { > ignite.close(); > } > }.start(); > } > } > > On Wed, Sep 30, 2015 at 5:45 PM, Paolo Di Tommaso < > paolo.ditomm...@gmail.com> wrote: > >> The best solution I've found so far is defining a "poison" task like the >> following one (Groovy code): >> >> static class PoisonPill implements IgniteRunnable { >> >> @IgniteInstanceResource >> private transient Ignite ignite >> >> @Override >> void run() { >> ignite.close() >> } >> } >> >> >> >> and broadcasting it to all remote nodes: >> >> def void shutdown() { >> grid.cluster().forRemotes().ignite().compute().broadcast(new >> PoisonPill()) >> } >> >> >> >> That works but in the "master" I'm getting the following exception: >> >> java.lang.IllegalStateException: Grid is in invalid state to perform this >> operation. It either not started yet or has already being or have stopped >> [gridName=nextflow, state=STOPPING] >> at >> org.apache.ignite.internal.GridKernalGatewayImpl.illegalState(GridKernalGatewayImpl.java:190) >> ~[ignite-core-1.4.0.jar:1.4.0] >> at >> org.apache.ignite.internal.GridKernalGatewayImpl.readLock(GridKernalGatewayImpl.java:90) >> ~[ignite-core-1.4.0.jar:1.4.0] >> at >> org.apache.ignite.internal.cluster.ClusterGroupAdapter.guard(ClusterGroupAdapter.java:170) >> ~[ignite-core-1.4.0.jar:1.4.0] >> at >> org.apache.ignite.internal.cluster.ClusterGroupAdapter.forPredicate(ClusterGroupAdapter.java:367) >> ~[ignite-core-1.4.0.jar:1.4.0] >> at >> org.apache.ignite.internal.cluster.ClusterGroupAdapter.forOthers(ClusterGroupAdapter.java:564) >> ~[ignite-core-1.4.0.jar:1.4.0] >> at >> org.apache.ignite.internal.cluster.ClusterGroupAdapter.forRemotes(ClusterGroupAdapter.java:536) >> ~[ignite-core-1.4.0.jar:1.4.0] >> at org.apache.ignite.cluster.ClusterGroup$forRemotes$1.call(Unknown >> Source) ~[na:na] >> at nextflow.executor.IgConnector.shutdown(IgConnector.groovy:155) >> ~[nxf-ignite-0.16.0-SNAPSHOT.jar:na] >> >> >> >> Is there a better way to shut-down all cluster instances ? >> >> >> Cheers, >> Paolo >> >> >> >> >> On Wed, Sep 30, 2015 at 4:03 PM, Paolo Di Tommaso < >> paolo.ditomm...@gmail.com> wrote: >> >>> Hi, >>> >>> >>> Is there an API to gently shut-down all the nodes that made up an Ignite >>> cluster? >>> >>> >>> Cheers, >>> Paolo >>> >>> >> >