インタフェースjava.util.concurrent.ScheduledFuture
の使用
パッケージ | 説明 |
---|---|
java.util.concurrent |
並行プログラミングでよく使用されるユーティリティ・クラスです。
|
-
java.util.concurrentでのScheduledFutureの使用
java.util.concurrentのScheduledFutureのサブインタフェース 修飾子と型 インタフェース 説明 interface
RunnableScheduledFuture<V>
Runnable
であるScheduledFuture
です。ScheduledFutureを返すjava.util.concurrentのメソッド 修飾子と型 メソッド 説明 ScheduledFuture<?>
ScheduledExecutorService. schedule(Runnable command, long delay, TimeUnit unit)
指定された遅延後に有効になるワン・ショット・タスクを送信します。<V> ScheduledFuture<V>
ScheduledExecutorService. schedule(Callable<V> callable, long delay, TimeUnit unit)
指定した遅延の後に有効になる、値を返すワン・ショット・タスクを送信します。ScheduledFuture<?>
ScheduledThreadPoolExecutor. schedule(Runnable command, long delay, TimeUnit unit)
<V> ScheduledFuture<V>
ScheduledThreadPoolExecutor. schedule(Callable<V> callable, long delay, TimeUnit unit)
ScheduledFuture<?>
ScheduledExecutorService. scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)
指定された初期遅延の後に最初に有効になり、続いて指定された期間で有効になる定期的なアクションを送信します。つまり、実行はinitialDelay
、initialDelay + period
、initialDelay + 2 * period
などの後に開始されます。ScheduledFuture<?>
ScheduledThreadPoolExecutor. scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)
指定された初期遅延の後に最初に有効になり、続いて指定された期間で有効になる定期的なアクションを送信します。つまり、実行はinitialDelay
、initialDelay + period
、initialDelay + 2 * period
などの後に開始されます。ScheduledFuture<?>
ScheduledExecutorService. scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit)
指定された初期遅延の後に最初に有効になる定期的なアクションを送信し、その後、1つの実行の終了と次の実行の開始の間の所定の遅延で送信します。ScheduledFuture<?>
ScheduledThreadPoolExecutor. scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit)
指定された初期遅延の後に最初に有効になる定期的なアクションを送信し、その後、1つの実行の終了と次の実行の開始の間の所定の遅延で送信します。