title: How to restart schedule when scheduleWithFixedDelay throws an exception?
body: <p>I use <code>ScheduledExecutorService</code> to schedule some tasks which need to run periodically.
  I want to know whether this code works to recover the schedule when an exception happens.</p>
  
  <pre><code>ScheduledExecutorService service = Executors.newScheduledThreadPool(1);
  this.startMemoryUpdateSchedule(service);//See below method
  
  //Recursive method to handle exception when run schedule task
  private void startMemoryUpdateSchedule(ScheduledExecutorService service) {
      ScheduledFuture&lt;?&gt; future = service.scheduleWithFixedDelay(new MemoryUpdateThread(), 1, UPDATE_MEMORY_SCHEDULE, TimeUnit.MINUTES);
      try {
          future.get();
      } catch (ExecutionException e) {
          e.printStackTrace();
          logger.error("Exception thrown for thread",e);
          future.cancel(true);
          this.startMemoryUpdateSchedule(service);
      } catch(Exception e) {
          logger.error("Other exception ",e);
      }
  }
  </code></pre>