@@ -0,0 +1,643 @@
+import java.util.concurrent.Executors;%0Aimport java.util.concurrent.ScheduledExecutorService;%0Aimport java.util.concurrent.TimeUnit;%0A%0Apublic class Main %7B%0A%09public static void main(String%5B%5D args) %7B%0A%0A%09%09final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();%0A%09%09executor.scheduleAtFixedRate(new Runnable() %7B%0A%09%09%09private final String text = %22demo%22;%0A%09%09%09private int number = 1;%0A%0A%09%09%09@Override%0A%09%09%09public void run() %7B%0A%09%09%09%09System.out.println(text + %22 %22 + String.format(%22%2505d%22, number) + %22 %22 + System.nanoTime());%0A%09%09%09%09number += 1;%0A%09%09%09%09if (number %3E 10) %7B%0A%09%09%09%09%09executor.shutdown();%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D, 1, 1, TimeUnit.SECONDS);%0A%0A%09%7D%0A%7D%0A

use ScheduledThreadPoolExecutor