1 /* 2 * Copyright 2019 The gRPC Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package io.grpc; 18 19 import com.google.common.util.concurrent.ForwardingExecutorService; 20 import java.util.concurrent.Callable; 21 import java.util.concurrent.ScheduledExecutorService; 22 import java.util.concurrent.ScheduledFuture; 23 import java.util.concurrent.TimeUnit; 24 25 /** 26 * Forwards all methods to delegate. 27 */ 28 abstract class ForwardingScheduledExecutorService extends ForwardingExecutorService 29 implements ScheduledExecutorService { 30 @Override delegate()31 protected abstract ScheduledExecutorService delegate(); 32 33 @Override schedule(Callable<V> callable, long delay, TimeUnit unit)34 public <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit) { 35 return delegate().schedule(callable, delay, unit); 36 } 37 38 @Override schedule(Runnable command, long delay, TimeUnit unit)39 public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit) { 40 return delegate().schedule(command, delay, unit); 41 } 42 43 @Override scheduleAtFixedRate( Runnable command, long initialDelay, long period, TimeUnit unit)44 public ScheduledFuture<?> scheduleAtFixedRate( 45 Runnable command, long initialDelay, long period, TimeUnit unit) { 46 return delegate().scheduleAtFixedRate(command, initialDelay, period, unit); 47 } 48 49 @Override scheduleWithFixedDelay( Runnable command, long initialDelay, long delay, TimeUnit unit)50 public ScheduledFuture<?> scheduleWithFixedDelay( 51 Runnable command, long initialDelay, long delay, TimeUnit unit) { 52 return delegate().scheduleWithFixedDelay(command, initialDelay, delay, unit); 53 } 54 } 55