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

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -