Is it safe to use single ScheduledExecutorService to run more than one task?
<p>I would like to use <code>ScheduledExecutorService</code> to export some data in scheduled manner. </p>

<p>In my code below I have called 2 different task in 2 different time intervals. There will be a chance where multiple task is schedule in 1 <code>ScheduledExecutorService</code> when user creates multiple scheduling to export multiple data(different reports).</p>

<ol>
<li><p>Is it safe to use single <code>ScheduledExecutorService</code> to run more than one task?</p></li>
<li><p>Is it possible to stop one of the task(Eg. <code>service.scheduleAtFixedRate(runnable2, 0, 10, TimeUnit.SECONDS);</code>) if user deletes specific scheduling?</p>

<pre><code>public static void main(String... args) {        
      Runnable runnable = new Runnable() {          public void run() {
    // task to run goes here
      System.out.println("Every 5 sec: "+ new java.util.Date());

  }
};

Runnable runnable2 = new Runnable() {
      public void run() {
        // task to run goes here
          System.out.println("Every 10 sec: "+ new java.util.Date());
      }
    };
ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor();
service.scheduleAtFixedRate(runnable, 0, 5, TimeUnit.SECONDS);
service.scheduleAtFixedRate(runnable2, 0, 10, TimeUnit.SECONDS);
}
</code></pre></li>
</ol>