001/* 002 * Copyright (C) 2011 The Guava Authors 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package com.google.common.util.concurrent; 018 019import com.google.common.annotations.Beta; 020 021import java.util.concurrent.Callable; 022import java.util.concurrent.ScheduledExecutorService; 023import java.util.concurrent.TimeUnit; 024 025/** 026 * A {@link ScheduledExecutorService} that returns {@link ListenableFuture} 027 * instances from its {@code ExecutorService} methods. To create an instance 028 * from an existing {@link ScheduledExecutorService}, call 029 * {@link MoreExecutors#listeningDecorator(ScheduledExecutorService)}. 030 * 031 * @author Chris Povirk 032 * @since 10.0 033 */ 034@Beta 035public interface ListeningScheduledExecutorService 036 extends ScheduledExecutorService, ListeningExecutorService { 037 038 /** @since 15.0 (previously returned ScheduledFuture) */ 039 @Override 040 ListenableScheduledFuture<?> schedule( 041 Runnable command, long delay, TimeUnit unit); 042 043 /** @since 15.0 (previously returned ScheduledFuture) */ 044 @Override 045 <V> ListenableScheduledFuture<V> schedule( 046 Callable<V> callable, long delay, TimeUnit unit); 047 048 /** @since 15.0 (previously returned ScheduledFuture) */ 049 @Override 050 ListenableScheduledFuture<?> scheduleAtFixedRate( 051 Runnable command, long initialDelay, long period, TimeUnit unit); 052 053 /** @since 15.0 (previously returned ScheduledFuture) */ 054 @Override 055 ListenableScheduledFuture<?> scheduleWithFixedDelay( 056 Runnable command, long initialDelay, long delay, TimeUnit unit); 057}