View Javadoc
1   /*
2    * Copyright (C) 2011 The Guava Authors
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5    * in compliance with the License. You may obtain a copy of the License at
6    *
7    * http://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software distributed under the License
10   * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11   * or implied. See the License for the specific language governing permissions and limitations under
12   * the License.
13   */
14  
15  package com.google.common.util.concurrent;
16  
17  import com.google.common.annotations.Beta;
18  import com.google.common.annotations.GwtIncompatible;
19  import java.util.concurrent.Callable;
20  import java.util.concurrent.ScheduledExecutorService;
21  import java.util.concurrent.TimeUnit;
22  
23  /**
24   * A {@link ScheduledExecutorService} that returns {@link ListenableFuture} instances from its
25   * {@code ExecutorService} methods. To create an instance from an existing {@link
26   * ScheduledExecutorService}, call {@link
27   * MoreExecutors#listeningDecorator(ScheduledExecutorService)}.
28   *
29   * @author Chris Povirk
30   * @since 10.0
31   */
32  @Beta
33  @GwtIncompatible
34  public interface ListeningScheduledExecutorService
35      extends ScheduledExecutorService, ListeningExecutorService {
36  
37    /** @since 15.0 (previously returned ScheduledFuture) */
38    @Override
39    ListenableScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit);
40  
41    /** @since 15.0 (previously returned ScheduledFuture) */
42    @Override
43    <V> ListenableScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit);
44  
45    /** @since 15.0 (previously returned ScheduledFuture) */
46    @Override
47    ListenableScheduledFuture<?> scheduleAtFixedRate(
48        Runnable command, long initialDelay, long period, TimeUnit unit);
49  
50    /** @since 15.0 (previously returned ScheduledFuture) */
51    @Override
52    ListenableScheduledFuture<?> scheduleWithFixedDelay(
53        Runnable command, long initialDelay, long delay, TimeUnit unit);
54  }