X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fconfig%2Fnetty-event-executor-config%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fyang%2Fnetty%2Feventexecutor%2FGlobalEventExecutorModule.java;h=8751a80b8d163838b08e8b014abc5371be777978;hb=44b5dbe52783a3a558b3eae619b01baf613f82e0;hp=3c52d8c17af7bfadba1d49e42a4d72b0b11459be;hpb=d71e327e51db32e967f7ebcb186e148f37f28117;p=controller.git diff --git a/opendaylight/config/netty-event-executor-config/src/main/java/org/opendaylight/controller/config/yang/netty/eventexecutor/GlobalEventExecutorModule.java b/opendaylight/config/netty-event-executor-config/src/main/java/org/opendaylight/controller/config/yang/netty/eventexecutor/GlobalEventExecutorModule.java index 3c52d8c17a..8751a80b8d 100644 --- a/opendaylight/config/netty-event-executor-config/src/main/java/org/opendaylight/controller/config/yang/netty/eventexecutor/GlobalEventExecutorModule.java +++ b/opendaylight/config/netty-event-executor-config/src/main/java/org/opendaylight/controller/config/yang/netty/eventexecutor/GlobalEventExecutorModule.java @@ -17,19 +17,10 @@ */ package org.opendaylight.controller.config.yang.netty.eventexecutor; -import io.netty.util.concurrent.AbstractEventExecutor; import io.netty.util.concurrent.EventExecutor; -import io.netty.util.concurrent.EventExecutorGroup; -import io.netty.util.concurrent.Future; import io.netty.util.concurrent.GlobalEventExecutor; -import io.netty.util.concurrent.ScheduledFuture; +import org.opendaylight.controller.config.yang.netty.eventexecutor.AutoCloseableEventExecutor.CloseableEventExecutorMixin; -import java.util.concurrent.Callable; -import java.util.concurrent.TimeUnit; - -/** -* -*/ public final class GlobalEventExecutorModule extends org.opendaylight.controller.config.yang.netty.eventexecutor.AbstractGlobalEventExecutorModule { @@ -51,91 +42,10 @@ public final class GlobalEventExecutorModule extends @Override public java.lang.AutoCloseable createInstance() { - return new GlobalEventExecutorCloseable(GlobalEventExecutor.INSTANCE); + EventExecutor eventExecutor = GlobalEventExecutor.INSTANCE; + return CloseableEventExecutorMixin.createCloseableProxy(eventExecutor); } - static final private class GlobalEventExecutorCloseable extends AbstractEventExecutor implements AutoCloseable { - - private EventExecutor executor; - - public GlobalEventExecutorCloseable(EventExecutor executor) { - this.executor = executor; - } - - @Override - public EventExecutorGroup parent() { - return this.executor.parent(); - } - - @Override - public boolean inEventLoop(Thread thread) { - return this.executor.inEventLoop(thread); - } - - @Override - public boolean isShuttingDown() { - return this.executor.isShuttingDown(); - } - - @Override - public Future shutdownGracefully(long quietPeriod, long timeout, TimeUnit unit) { - return this.executor.shutdownGracefully(quietPeriod, timeout, unit); - } - - @Override - public Future terminationFuture() { - return this.executor.terminationFuture(); - } - @Override - public boolean isShutdown() { - return this.executor.isShutdown(); - } - @Override - public boolean isTerminated() { - return this.executor.isTerminated(); - } - - @Override - public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { - return this.executor.awaitTermination(timeout, unit); - } - - @Override - public void execute(Runnable command) { - this.executor.execute(command); - } - - @Override - public void close() throws Exception { - shutdownGracefully(); - } - - @SuppressWarnings("deprecation") - @Override - public void shutdown() { - this.executor.shutdown(); - } - - @Override - public ScheduledFuture scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) { - return this.executor.scheduleWithFixedDelay(command, initialDelay, delay, unit); - } - - @Override - public ScheduledFuture schedule(Runnable command, long delay, TimeUnit unit) { - return this.executor.schedule(command, delay, unit); - } - - @Override - public ScheduledFuture schedule(Callable callable, long delay, TimeUnit unit) { - return this.executor.schedule(callable, delay, unit); - } - - @Override - public ScheduledFuture scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) { - return this.executor.scheduleAtFixedRate(command, initialDelay, period, unit); - } - } }