3 * Copyright (C) 2009-2017 SonarSource SA
4 * mailto:info AT sonarsource DOT com
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 package org.sonar.process.cluster.health;
22 import java.util.Collection;
23 import java.util.List;
24 import java.util.concurrent.Callable;
25 import java.util.concurrent.ExecutionException;
26 import java.util.concurrent.Future;
27 import java.util.concurrent.ScheduledExecutorService;
28 import java.util.concurrent.ScheduledFuture;
29 import java.util.concurrent.TimeUnit;
30 import java.util.concurrent.TimeoutException;
32 class DelegateHealthStateRefresherExecutorService implements HealthStateRefresherExecutorService {
33 private final ScheduledExecutorService delegate;
35 DelegateHealthStateRefresherExecutorService(ScheduledExecutorService delegate) {
36 this.delegate = delegate;
40 public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit) {
41 return delegate.schedule(command, delay, unit);
45 public <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit) {
46 return delegate.schedule(callable, delay, unit);
50 public ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) {
51 return delegate.scheduleAtFixedRate(command, initialDelay, period, unit);
55 public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) {
56 return delegate.scheduleWithFixedDelay(command, initialDelay, delay, unit);
60 public void shutdown() {
65 public List<Runnable> shutdownNow() {
66 return delegate.shutdownNow();
70 public boolean isShutdown() {
71 return delegate.isShutdown();
75 public boolean isTerminated() {
76 return delegate.isTerminated();
80 public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
81 return delegate.awaitTermination(timeout, unit);
85 public <T> Future<T> submit(Callable<T> task) {
86 return delegate.submit(task);
90 public <T> Future<T> submit(Runnable task, T result) {
91 return delegate.submit(task, result);
95 public Future<?> submit(Runnable task) {
96 return delegate.submit(task);
100 public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException {
101 return delegate.invokeAll(tasks);
105 public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException {
106 return delegate.invokeAll(tasks, timeout, unit);
110 public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException {
111 return delegate.invokeAny(tasks);
115 public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
116 return delegate.invokeAny(tasks, timeout, unit);
120 public void execute(Runnable command) {
121 delegate.execute(command);