1 /* 2 * Copyright (C) 2006 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 java.util.concurrent.Callable; 20 import java.util.concurrent.TimeUnit; 21 22 /** 23 * A TimeLimiter implementation which actually does not attempt to limit time 24 * at all. This may be desirable to use in some unit tests. More importantly, 25 * attempting to debug a call which is time-limited would be extremely annoying, 26 * so this gives you a time-limiter you can easily swap in for your real 27 * time-limiter while you're debugging. 28 * 29 * @author Kevin Bourrillion 30 * @since 2009.09.15 <b>tentative</b> 31 */ 32 public class FakeTimeLimiter implements TimeLimiter { 33 public <T> T newProxy(T target, Class<T> interfaceType, long timeoutDuration, 34 TimeUnit timeoutUnit) { 35 return target; // ha ha 36 } 37 38 public <T> T callWithTimeout(Callable<T> callable, long timeoutDuration, 39 TimeUnit timeoutUnit, boolean amInterruptible) throws Exception { 40 return callable.call(); // fooled you 41 } 42 } 43