java - How to reuse an executor objects after threads shutdown -


i have java 7 program parallel processes chunks of data , use executor service api create threads:

pool = executors.newfixedthreadpool(size > 0 ? size : thread_max);

and wait threads finish up:

    try {         pool.shutdown();         // todo 60 seconds sufficient process route?         pool.awaittermination(60l, timeunit.seconds);     } catch (interruptedexception e) {         e.printstacktrace();         pool.shutdownnow(); // todo consider rerunning handlehashes!     } {         release();     } 

but once termination happens, need re-instantiate executor. i'd rather reuse created threads after previous chunk of data has been processed. make profiling easier me.

after .shutdown() how can reuse executor object , threads inside instead of re-instantiating?

perhaps, there 3rd party executor apis have feature?

maybe restructure program processing threads don't shut down. parent thread gives child threads data process. process , wait more data. don't kill threads or shut down pool between data processes.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -