Fixup checkstyle
[controller.git] / opendaylight / config / netty-event-executor-config / src / main / java / org / opendaylight / controller / config / yang / netty / eventexecutor / OSGiGlobalEventExecutor.java
1 /*
2  * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.config.yang.netty.eventexecutor;
9
10 import static io.netty.util.concurrent.GlobalEventExecutor.INSTANCE;
11
12 import com.google.common.annotations.Beta;
13 import io.netty.util.concurrent.EventExecutor;
14 import io.netty.util.concurrent.EventExecutorGroup;
15 import io.netty.util.concurrent.Future;
16 import io.netty.util.concurrent.ProgressivePromise;
17 import io.netty.util.concurrent.Promise;
18 import io.netty.util.concurrent.ScheduledFuture;
19 import java.util.Collection;
20 import java.util.Iterator;
21 import java.util.List;
22 import java.util.concurrent.Callable;
23 import java.util.concurrent.ExecutionException;
24 import java.util.concurrent.TimeUnit;
25 import java.util.concurrent.TimeoutException;
26 import org.osgi.service.component.annotations.Activate;
27 import org.osgi.service.component.annotations.Component;
28 import org.osgi.service.component.annotations.Deactivate;
29 import org.slf4j.Logger;
30 import org.slf4j.LoggerFactory;
31
32 @Beta
33 @Component(immediate = true, property = "type=global-event-executor")
34 public final class OSGiGlobalEventExecutor implements EventExecutor {
35     private static final Logger LOG = LoggerFactory.getLogger(OSGiGlobalEventExecutor.class);
36
37     @Override
38     public boolean isShuttingDown() {
39         return INSTANCE.isShuttingDown();
40     }
41
42     @Override
43     public Future<?> shutdownGracefully() {
44         return INSTANCE.shutdownGracefully();
45     }
46
47     @Override
48     public Future<?> shutdownGracefully(final long quietPeriod, final long timeout, final TimeUnit unit) {
49         return INSTANCE.shutdownGracefully(quietPeriod, timeout, unit);
50     }
51
52     @Override
53     public Future<?> terminationFuture() {
54         return INSTANCE.terminationFuture();
55     }
56
57     @Override
58     @Deprecated
59     public void shutdown() {
60         INSTANCE.shutdown();
61     }
62
63     @Override
64     public List<Runnable> shutdownNow() {
65         return INSTANCE.shutdownNow();
66     }
67
68     @Override
69     public Iterator<EventExecutor> iterator() {
70         return INSTANCE.iterator();
71     }
72
73     @Override
74     public Future<?> submit(final Runnable task) {
75         return INSTANCE.submit(task);
76     }
77
78     @Override
79     public <T> Future<T> submit(final Runnable task, final T result) {
80         return INSTANCE.submit(task, result);
81     }
82
83     @Override
84     public <T> Future<T> submit(final Callable<T> task) {
85         return INSTANCE.submit(task);
86     }
87
88     @Override
89     public ScheduledFuture<?> schedule(final Runnable command, final long delay, final TimeUnit unit) {
90         return INSTANCE.schedule(command, delay, unit);
91     }
92
93     @Override
94     public <V> ScheduledFuture<V> schedule(final Callable<V> callable, final long delay, final TimeUnit unit) {
95         return INSTANCE.schedule(callable, delay, unit);
96     }
97
98     @Override
99     public ScheduledFuture<?> scheduleAtFixedRate(final Runnable command, final long initialDelay, final long period,
100             final TimeUnit unit) {
101         return INSTANCE.scheduleAtFixedRate(command, initialDelay, period, unit);
102     }
103
104     @Override
105     public ScheduledFuture<?> scheduleWithFixedDelay(final Runnable command, final long initialDelay, final long delay,
106             final TimeUnit unit) {
107         return INSTANCE.scheduleWithFixedDelay(command, initialDelay, delay, unit);
108     }
109
110     @Override
111     public boolean isShutdown() {
112         return INSTANCE.isShutdown();
113     }
114
115     @Override
116     public boolean isTerminated() {
117         return INSTANCE.isTerminated();
118     }
119
120     @Override
121     public boolean awaitTermination(final long timeout, final TimeUnit unit) throws InterruptedException {
122         return INSTANCE.awaitTermination(timeout, unit);
123     }
124
125     @Override
126     public <T> List<java.util.concurrent.Future<T>> invokeAll(final Collection<? extends Callable<T>> tasks)
127             throws InterruptedException {
128         return INSTANCE.invokeAll(tasks);
129     }
130
131     @Override
132     public <T> List<java.util.concurrent.Future<T>> invokeAll(final Collection<? extends Callable<T>> tasks,
133             final long timeout, final TimeUnit unit) throws InterruptedException {
134         return INSTANCE.invokeAll(tasks, timeout, unit);
135     }
136
137     @Override
138     public <T> T invokeAny(final Collection<? extends Callable<T>> tasks)
139             throws InterruptedException, ExecutionException {
140         return INSTANCE.invokeAny(tasks);
141     }
142
143     @Override
144     public <T> T invokeAny(final Collection<? extends Callable<T>> tasks, final long timeout, final TimeUnit unit)
145             throws InterruptedException, ExecutionException, TimeoutException {
146         return INSTANCE.invokeAny(tasks, timeout, unit);
147     }
148
149     @Override
150     public void execute(final Runnable command) {
151         INSTANCE.execute(command);
152     }
153
154     @Override
155     public EventExecutor next() {
156         return INSTANCE.next();
157     }
158
159     @Override
160     public EventExecutorGroup parent() {
161         return INSTANCE.parent();
162     }
163
164     @Override
165     public boolean inEventLoop() {
166         return INSTANCE.inEventLoop();
167     }
168
169     @Override
170     public boolean inEventLoop(final Thread thread) {
171         return INSTANCE.inEventLoop(thread);
172     }
173
174     @Override
175     public <V> Promise<V> newPromise() {
176         return INSTANCE.newPromise();
177     }
178
179     @Override
180     public <V> ProgressivePromise<V> newProgressivePromise() {
181         return INSTANCE.newProgressivePromise();
182     }
183
184     @Override
185     public <V> Future<V> newSucceededFuture(final V result) {
186         return INSTANCE.newSucceededFuture(result);
187     }
188
189     @Override
190     public <V> Future<V> newFailedFuture(final Throwable cause) {
191         return INSTANCE.newFailedFuture(cause);
192     }
193
194     @Activate
195     void activate() {
196         LOG.info("Global Event executor enabled");
197     }
198
199     @Deactivate
200     void deactivate() {
201         LOG.info("Global Event executor disabled");
202     }
203
204 }