You may want to implement ComputeJobMasterLeaveAware [1] interface for your 
compute jobs. An interface implementation will be called on servers side for 
every job that was spawned by client node that has been shut down.

Besides, you can refer to this example [2] that demonstrates how to use the 
interface.

However, I still don’t see a reason why you spawn 6 threads for every compute 
job. In general you may reuse existing threads from the public pool by relying 
on ComputeJobContinuation [3] which usage is demonstrated in this example [4].

[1] 
https://ignite.apache.org/releases/1.7.0/javadoc/org/apache/ignite/compute/ComputeJobMasterLeaveAware.html
 
<https://ignite.apache.org/releases/1.7.0/javadoc/org/apache/ignite/compute/ComputeJobMasterLeaveAware.html>
[2] 
https://github.com/gridgain/gridgain-advanced-examples/blob/master/src/main/java/org/gridgain/examples/compute/masterleave/ComputeMasterLeaveAwareExample.java
[3] 
https://ignite.apache.org/releases/1.7.0/javadoc/org/apache/ignite/compute/ComputeJobContinuation.html
 
<https://ignite.apache.org/releases/1.7.0/javadoc/org/apache/ignite/compute/ComputeJobContinuation.html>
[4] 
https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeFibonacciContinuationExample.java
 
<https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeFibonacciContinuationExample.java>

—
Denis

> On Nov 14, 2016, at 5:41 AM, alex <alexwan...@gmail.com> wrote:
> 
> Hi vdpyatkov, I tried like this , problem still exists. The client code just
> as below:
> 
>        ClusterGroup rmts = getIgnite().cluster().forRemotes();
>        IgniteCompute compute = getIgnite().compute(rmts).withAsync();
>        compute.apply(new IgniteClosure<String, String>() {
>            @Override
>            public String apply(String o) {
>                return o;
>            }
>        }, Arrays.asList("Print words using runnable".split(" ")));
> 
>        IgniteFuture future = compute.future();
>        future.cancel();
> 
>        getIgnite().close();
> 
> 
> 
> --
> View this message in context: 
> http://apache-ignite-users.70518.x6.nabble.com/Remote-Server-Thread-Not-exit-when-Job-finished-Cause-out-of-memory-tp8934p8947.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Reply via email to