1 /* 2 * Copyright (C) 2009 Google Inc. 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 com.google.common.util.concurrent; 18 19 import com.google.common.base.Service; 20 import com.google.common.collect.ForwardingObject; 21 22 import java.util.concurrent.Future; 23 24 /** 25 * A {@link Service} that forwards all method calls to another service. 26 * 27 * @author Chris Nokleberg 28 * @since 2009.09.15 <b>tentative</b> 29 */ 30 public abstract class ForwardingService extends ForwardingObject 31 implements Service { 32 33 @Override protected abstract Service delegate(); 34 35 /*@Override*/ public Future<State> start() { 36 return delegate().start(); 37 } 38 39 /*@Override*/ public State state() { 40 return delegate().state(); 41 } 42 43 /*@Override*/ public Future<State> stop() { 44 return delegate().stop(); 45 } 46 47 /*@Override*/ public State startAndWait() { 48 return delegate().startAndWait(); 49 } 50 51 /*@Override*/ public State stopAndWait() { 52 return delegate().stopAndWait(); 53 } 54 55 /*@Override*/ public boolean isRunning() { 56 return delegate().isRunning(); 57 } 58 } 59