0 Replies Latest reply on Aug 24, 2017 10:59 PM by Chinmay

    TimerTasks vs ExecutorService

    Chinmay

      I observed that TimerTasks are used extensively in Openfire. Is there any clear advantage here, of using those in place of ScheduledExecutorService?


      There are at least a couple of good things of ExecutorService over TimerTask -

      1. Can utilize multiple threads. However, it may not be possible in some cases in Openfire, where the order of data is important.

      2. Can handle runtime exceptions, which can be utilized for retrying execution.

       

      I would like to know if it is worth investing to move to using ExecutorService.

       

      Thanks,

      Chinmay