Jonathan Hart | 7061acd | 2015-03-04 13:15:32 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
Jonathan Hart | 7061acd | 2015-03-04 13:15:32 -0800 | [diff] [blame] | 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 | package org.onlab.junit; |
| 17 | |
| 18 | import java.util.Collection; |
| 19 | import java.util.List; |
| 20 | import java.util.concurrent.Callable; |
| 21 | import java.util.concurrent.ExecutionException; |
| 22 | import java.util.concurrent.Future; |
| 23 | import java.util.concurrent.ScheduledExecutorService; |
| 24 | import java.util.concurrent.ScheduledFuture; |
| 25 | import java.util.concurrent.TimeUnit; |
| 26 | import java.util.concurrent.TimeoutException; |
| 27 | |
| 28 | /** |
| 29 | * A scheduled executor service that does not do any of the work scheduled to it. |
| 30 | * <p> |
| 31 | * This is useful for testing when you want to disable a background scheduled |
| 32 | * task. |
| 33 | * </p> |
| 34 | */ |
| 35 | public class NullScheduledExecutor implements ScheduledExecutorService { |
| 36 | @Override |
| 37 | public ScheduledFuture<?> schedule(Runnable command, long delay, |
| 38 | TimeUnit unit) { |
| 39 | return null; |
| 40 | } |
| 41 | |
| 42 | @Override |
| 43 | public <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay, |
| 44 | TimeUnit unit) { |
| 45 | return null; |
| 46 | } |
| 47 | |
| 48 | @Override |
| 49 | public ScheduledFuture<?> scheduleAtFixedRate(Runnable command, |
| 50 | long initialDelay, |
| 51 | long period, TimeUnit unit) { |
| 52 | return null; |
| 53 | } |
| 54 | |
| 55 | @Override |
| 56 | public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, |
| 57 | long initialDelay, |
| 58 | long delay, |
| 59 | TimeUnit unit) { |
| 60 | return null; |
| 61 | } |
| 62 | |
| 63 | @Override |
| 64 | public void shutdown() { |
| 65 | |
| 66 | } |
| 67 | |
| 68 | @Override |
| 69 | public List<Runnable> shutdownNow() { |
| 70 | return null; |
| 71 | } |
| 72 | |
| 73 | @Override |
| 74 | public boolean isShutdown() { |
| 75 | return false; |
| 76 | } |
| 77 | |
| 78 | @Override |
| 79 | public boolean isTerminated() { |
| 80 | return false; |
| 81 | } |
| 82 | |
| 83 | @Override |
| 84 | public boolean awaitTermination(long timeout, TimeUnit unit) |
| 85 | throws InterruptedException { |
| 86 | return false; |
| 87 | } |
| 88 | |
| 89 | @Override |
| 90 | public <T> Future<T> submit(Callable<T> task) { |
| 91 | return null; |
| 92 | } |
| 93 | |
| 94 | @Override |
| 95 | public <T> Future<T> submit(Runnable task, T result) { |
| 96 | return null; |
| 97 | } |
| 98 | |
| 99 | @Override |
| 100 | public Future<?> submit(Runnable task) { |
| 101 | return null; |
| 102 | } |
| 103 | |
| 104 | @Override |
| 105 | public <T> List<Future<T>> invokeAll( |
| 106 | Collection<? extends Callable<T>> tasks) |
| 107 | throws InterruptedException { |
| 108 | return null; |
| 109 | } |
| 110 | |
| 111 | @Override |
| 112 | public <T> List<Future<T>> invokeAll( |
| 113 | Collection<? extends Callable<T>> tasks, long timeout, |
| 114 | TimeUnit unit) throws InterruptedException { |
| 115 | return null; |
| 116 | } |
| 117 | |
| 118 | @Override |
| 119 | public <T> T invokeAny(Collection<? extends Callable<T>> tasks) |
| 120 | throws InterruptedException, ExecutionException { |
| 121 | return null; |
| 122 | } |
| 123 | |
| 124 | @Override |
| 125 | public <T> T invokeAny(Collection<? extends Callable<T>> tasks, |
| 126 | long timeout, TimeUnit unit) |
| 127 | throws InterruptedException, ExecutionException, TimeoutException { |
| 128 | return null; |
| 129 | } |
| 130 | |
| 131 | @Override |
| 132 | public void execute(Runnable command) { |
| 133 | |
| 134 | } |
| 135 | } |