Reason for calling shutdown() on ExecutorService

后端 未结 5 1748
-上瘾入骨i
-上瘾入骨i 2020-12-04 07:46

I was reading about it quite a bit in past couple hours, and I simply cannot see any reason (valid reason) to call shutdown() on the Exec

5条回答
  •  悲哀的现实
    2020-12-04 08:35

    This is genuine notwithstanding for planned undertakings, e.g., for a ScheduledExecutorService: new cases of the booked assignment won't run.

    We should expect you have a comfort application which has an agent administration running N errands.

    I'm not catching it's meaning effortlessly? Perhaps you need your application to not have the option to submit more assignments to the agent administration and in the meantime you need to sit tight for your current N undertakings to finish.

    Except if you're totally positive your errands will in the end, you should need to sit tight for a given break and after that simply exit, deserting the running strings.

    In the event that your activitys are intended to react to interference this will work fine.

    Another intriguing situation is the point at which you have a ScheduledExecutorService that plays out an activity.

    The best way to stop the chain of activity is to call shutdown()

提交回复
热议问题