java - The use of executor.shutdown() -
look @ following piece of code:
public void pinger() { scheduledthreadpoolexecutor executor = new scheduledthreadpoolexecutor(1); executor.scheduleatfixedrate(runnable, start, rate, timeunit.seconds); executor.shutdown(); }
is there use of writing shutdown command in case? different clients create own runnable objects , invoke function.
when shutdown executor, no new task accepted. since create new 1 inside pinger method every task has own executor. shutdown write free resource once corrent task terminated.
Comments
Post a Comment