Java ServiceExecutor terminating condition

后端 未结 4 1863
我在风中等你
我在风中等你 2021-01-22 07:21

I\'m new to java executor stuff.

I\'m using Java\'s ExecutorService to launch several threads to process data.

Executor executor = Executors.newFixedThre         


        
4条回答
  •  抹茶落季
    2021-01-22 07:57

    Executor will keep running with it under lying thread pool. you can still execute or submit a new task. It is recommended to shutdown Executor service call ExecutorService.html#shutdown() which attempts to stop all actively executing tasks, halts the processing of waiting tasks, and returns a list of the tasks that were awaiting execution.

    You can also use ExecutorService.html#shutdownNow() which stops all actively executing tasks, halts the processing of waiting tasks, and returns a list of the tasks that were awaiting execution. It is useful when you need immediate shutdown.

提交回复
热议问题