タイマー付きの非同期処理実行サービス 10秒後に開始, 5秒間隔で繰り返し @Path("/sample") public class SampleResource { @Resource ManagedScheduledExecutorService scheduler; @POST public void post() { scheduler .scheduleWithFixedDelay(() -> { // タスク1 }, 10, 5, TimeUnit.SECONDS); ... } } public class SampleProgram { public static final int POOL_SIZE = 5; public static void main(String[] args) { ScheduledExecutorService scheduler = Executors. newScheduledThreadPool(POOL_SIZE); scheduler .scheduleWithFixedDelay(() -> { // タスク1 }, 10, 5, TimeUnit.SECONDS); ... } }