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  
27  /**
28   * Abstract base class for {@link EventExecutorGroup} implementations.
29   */
30  public abstract class AbstractEventExecutorGroup implements EventExecutorGroup {
31  
32      @Override
33      public Future<?> submit(Runnable task) {
34          return next().submit(task);
35      }
36  
37      @Override
38      public <T> Future<T> submit(Runnable task, T result) {
39          return next().submit(task, result);
40      }
41  
42      @Override
43      public <T> Future<T> submit(Callable<T> task) {
44          return next().submit(task);
45      }
46  
47      @Override
48      public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit) {
49          return next().schedule(command, delay, unit);
50      }
51  
52      @Override
53      public <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit) {
54          return next().schedule(callable, delay, unit);
55      }
56  
57      @Override
58      public ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) {
59          return next().scheduleAtFixedRate(command, initialDelay, period, unit);
60      }
61  
62      @Override
63      public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) {
64          return next().scheduleWithFixedDelay(command, initialDelay, delay, unit);
65      }
66  
67      @Override
68      public Future<?> shutdownGracefully() {
69          return shutdownGracefully(2, 15, TimeUnit.SECONDS);
70      }
71  
72      /**
73       * @deprecated {@link #shutdownGracefully(long, long, TimeUnit)} or {@link #shutdownGracefully()} instead.
74       */
75      @Override
76      @Deprecated
77      public abstract void shutdown();
78  
79      /**
80       * @deprecated {@link #shutdownGracefully(long, long, TimeUnit)} or {@link #shutdownGracefully()} instead.
81       */
82      @Override
83      @Deprecated
84      public List<Runnable> shutdownNow() {
85          shutdown();
86          return Collections.emptyList();
87      }
88  
89      @Override
90      public <T> List<java.util.concurrent.Future<T>> invokeAll(Collection<? extends Callable<T>> tasks)
91              throws InterruptedException {
92          return next().invokeAll(tasks);
93      }
94  
95      @Override
96      public <T> List<java.util.concurrent.Future<T>> invokeAll(
97              Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException {
98          return next().invokeAll(tasks, timeout, unit);
99      }
100 
101     @Override
102     public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException {
103         return next().invokeAny(tasks);
104     }
105 
106     @Override
107     public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
108             throws InterruptedException, ExecutionException, TimeoutException {
109         return next().invokeAny(tasks, timeout, unit);
110     }
111 
112     @Override
113     public void execute(Runnable command) {
114         next().execute(command);
115     }
116 }