Go to the documentation of this file.00001 package org.ros.concurrent;
00002
00003 import java.util.Collection;
00004 import java.util.List;
00005 import java.util.concurrent.Callable;
00006 import java.util.concurrent.ExecutionException;
00007 import java.util.concurrent.ExecutorService;
00008 import java.util.concurrent.Future;
00009 import java.util.concurrent.ScheduledExecutorService;
00010 import java.util.concurrent.ScheduledFuture;
00011 import java.util.concurrent.TimeUnit;
00012 import java.util.concurrent.TimeoutException;
00013
00021 public class SharedScheduledExecutorService implements ScheduledExecutorService {
00022
00026 private ScheduledExecutorService scheduledExecutorService;
00027
00028 public SharedScheduledExecutorService(ScheduledExecutorService wrapped) {
00029 this.scheduledExecutorService = wrapped;
00030 }
00031
00036 @Override
00037 public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
00038 return scheduledExecutorService.awaitTermination(timeout, unit);
00039 }
00040
00045 @Override
00046 public void execute(Runnable command) {
00047 scheduledExecutorService.execute(command);
00048 }
00049
00054 @Override
00055 public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout,
00056 TimeUnit unit) throws InterruptedException {
00057 return scheduledExecutorService.invokeAll(tasks, timeout, unit);
00058 }
00059
00063 @Override
00064 public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks)
00065 throws InterruptedException {
00066 return scheduledExecutorService.invokeAll(tasks);
00067 }
00068
00073 @Override
00074 public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
00075 throws InterruptedException, ExecutionException, TimeoutException {
00076 return scheduledExecutorService.invokeAny(tasks, timeout, unit);
00077 }
00078
00082 @Override
00083 public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException,
00084 ExecutionException {
00085 return scheduledExecutorService.invokeAny(tasks);
00086 }
00087
00091 @Override
00092 public boolean isShutdown() {
00093 return scheduledExecutorService.isShutdown();
00094 }
00095
00099 @Override
00100 public boolean isTerminated() {
00101 return scheduledExecutorService.isTerminated();
00102 }
00103
00108 @Override
00109 public <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit) {
00110 return scheduledExecutorService.schedule(callable, delay, unit);
00111 }
00112
00117 @Override
00118 public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit) {
00119 return scheduledExecutorService.schedule(command, delay, unit);
00120 }
00121
00126 @Override
00127 public ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period,
00128 TimeUnit unit) {
00129 return scheduledExecutorService.scheduleAtFixedRate(command, initialDelay, period, unit);
00130 }
00131
00136 @Override
00137 public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay,
00138 TimeUnit unit) {
00139 return scheduledExecutorService.scheduleWithFixedDelay(command, initialDelay, delay, unit);
00140 }
00141
00145 @Override
00146 public void shutdown() {
00147 throw new UnsupportedOperationException("Cannot shut down service");
00148 }
00149
00153 @Override
00154 public List<Runnable> shutdownNow() {
00155 throw new UnsupportedOperationException("Cannot shut down service");
00156 }
00157
00161 @Override
00162 public <T> Future<T> submit(Callable<T> task) {
00163 return scheduledExecutorService.submit(task);
00164 }
00165
00170 @Override
00171 public <T> Future<T> submit(Runnable task, T result) {
00172 return scheduledExecutorService.submit(task, result);
00173 }
00174
00178 @Override
00179 public Future<?> submit(Runnable task) {
00180 return scheduledExecutorService.submit(task);
00181 }
00182 }