Hi Alex, You should do like this:
IgniteCompute compute = ignite.compute().withAsync(); compute.apply(...) IgniteFuture future = compute.future(); ... future.cancel(); And handle Thread.interrupted() flag into closure. On Mon, Nov 14, 2016 at 2:35 PM, alex <alexwan...@gmail.com> wrote: > Thanks vdpyatkov. > > Currently, the number of threads is not the problem. > > The problem is that when client finished, how to finish threads on server > node which created by this client. > > For example, client code is: > > String cacheKey = "jobIds"; > String cname = "myCacheName"; > ClusterGroup rmts =ignite.cluster().forRemotes(); > IgniteCache<String, List<String>> cache = ignite.getOrCreateCache(cname) > ; > List<String> jobList = cache.get(cacheKey); > Collection<String> res = ignite.compute(rmts).apply( > new IgniteClosure<String, String>() { > @Override > public String apply(String word) { > return word; > } > }, > jobList > ); > ignite.close(); > System.out.println("ignite Closed"); > > if (res == null) { > System.out.println("Error: Result is null"); > return; > } > > res.forEach(s -> { > System.out.println(s); > }); > System.out.println("Finished!"); > > > When client initiate ignite instance, server side create 6 threads for this > computing job. > After client program exit, the 6 threads still alive on server. And never > exit until I kill the server. > How can I finish threads after client job finished gracefully. > > Thanks for any suggestions > > > vdpyatkov wrote > > Hi Alex, > > I think, these threads are executing into pools of threads, and number of > > threads always restricted by pool size[1]. > > You can configure sizes manually: > > > > > > <property name="marshallerCacheThreadPoolSize" value="12"/> > > > > <property name="utilityCachePoolSize" value="12"/> > > [1]: > > https://apacheignite.readme.io/v1.7/docs/performance-tips# > configure-thread-pools > > > vdpyatkov wrote > > Hi Alex, > > I think, these threads are executing into pools of threads, and number of > > threads always restricted by pool size[1]. > > You can configure sizes manually: > > > > > > <property name="marshallerCacheThreadPoolSize" value="12"/> > > > > <property name="utilityCachePoolSize" value="12"/> > > [1]: > > https://apacheignite.readme.io/v1.7/docs/performance-tips# > configure-thread-pools > > > > > > -- > 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-tp8934p8939.html > Sent from the Apache Ignite Users mailing list archive at Nabble.com. > -- Vladislav Pyatkov