I've got two scheduled tasks. One has the higher priority : its scheduling must be respected the best. The second one has a lower priority : the performances may more impact its scheduling.
In ThreadGroup we can the Priority. But I don't find how to this with Executors.
final ScheduledExecutorService serviceProduce = Executors.newScheduledThreadPool(2);
// May be delayed by performance
serviceProduce.scheduleAtFixedRate(new ComputeThread(), 0, 10, TimeUnit.MILLISECONDS);
// Should be kept as much as possible on schedule
serviceProduce.scheduleAtFixedRate(new ProduceOutputThread(), 0, 30, TimeUnit.MILLISECONDS);