View Javadoc
1   /*
2    * Copyright 2013 The Netty Project
3    *
4    * The Netty Project licenses this file to you under the Apache License,
5    * version 2.0 (the "License"); you may not use this file except in compliance
6    * with the License. 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, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations
14   * under the License.
15   */
16  package io.netty.util.concurrent;
17  
18  import java.util.Collection;
19  import java.util.Collections;
20  import java.util.List;
21  import java.util.concurrent.Callable;
22  import java.util.concurrent.ExecutionException;
23  import java.util.concurrent.TimeUnit;
24  import java.util.concurrent.TimeoutException;
25  
26  import static io.netty.util.concurrent.AbstractEventExecutor.*;
27  
28  
29  /**
30   * Abstract base class for {@link EventExecutorGroup} implementations.
31   */
32  public abstract class AbstractEventExecutorGroup implements EventExecutorGroup {
33      @Override
34      public Future<?> submit(Runnable task) {
35          return next().submit(task);
36      }
37  
38      @Override
39      public <T> Future<T> submit(Runnable task, T result) {
40          return next().submit(task, result);
41      }
42  
43      @Override
44      public <T> Future<T> submit(Callable<T> task) {
45          return next().submit(task);
46      }
47  
48      @Override
49      public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit) {
50          return next().schedule(command, delay, unit);
51      }
52  
53      @Override
54      public <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit) {
55          return next().schedule(callable, delay, unit);
56      }
57  
58      @Override
59      public ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) {
60          return next().scheduleAtFixedRate(command, initialDelay, period, unit);
61      }
62  
63      @Override
64      public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) {
65          return next().scheduleWithFixedDelay(command, initialDelay, delay, unit);
66      }
67  
68      @Override
69      public Future<?> shutdownGracefully() {
70          return shutdownGracefully(DEFAULT_SHUTDOWN_QUIET_PERIOD, DEFAULT_SHUTDOWN_TIMEOUT, TimeUnit.SECONDS);
71      }
72  
73      /**
74       * @deprecated {@link #shutdownGracefully(long, long, TimeUnit)} or {@link #shutdownGracefully()} instead.
75       */
76      @Override
77      @Deprecated
78      public abstract void shutdown();
79  
80      /**
81       * @deprecated {@link #shutdownGracefully(long, long, TimeUnit)} or {@link #shutdownGracefully()} instead.
82       */
83      @Override
84      @Deprecated
85      public List<Runnable> shutdownNow() {
86          shutdown();
87          return Collections.emptyList();
88      }
89  
90      @Override
91      public <T> List<java.util.concurrent.Future<T>> invokeAll(Collection<? extends Callable<T>> tasks)
92              throws InterruptedException {
93          return next().invokeAll(tasks);
94      }
95  
96      @Override
97      public <T> List<java.util.concurrent.Future<T>> invokeAll(
98              Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException {
99          return next().invokeAll(tasks, timeout, unit);
100     }
101 
102     @Override
103     public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException {
104         return next().invokeAny(tasks);
105     }
106 
107     @Override
108     public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
109             throws InterruptedException, ExecutionException, TimeoutException {
110         return next().invokeAny(tasks, timeout, unit);
111     }
112 
113     @Override
114     public void execute(Runnable command) {
115         next().execute(command);
116     }
117 }