Class ExecutorNettyAdapter
- java.lang.Object
-
- org.apache.activemq.artemis.protocol.amqp.proton.handler.ExecutorNettyAdapter
-
- All Implemented Interfaces:
io.netty.channel.EventLoop,io.netty.channel.EventLoopGroup,io.netty.util.concurrent.EventExecutor,io.netty.util.concurrent.EventExecutorGroup,io.netty.util.concurrent.OrderedEventExecutor,AutoCloseable,Iterable<io.netty.util.concurrent.EventExecutor>,Executor,ExecutorService,ScheduledExecutorService
public class ExecutorNettyAdapter extends Object implements io.netty.channel.EventLoop, AutoCloseable
Test cases may supply a simple executor instead of the real Netty Executor On that case this is a simple adapter for what's needed from these tests. Not intended to be used in production. TODO: This could be refactored out of the main codebase but at a high cost. We may do it some day if we find an easy way that won't clutter the code too much.
-
-
Constructor Summary
Constructors Constructor Description ExecutorNettyAdapter(ArtemisExecutor executor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanawaitTermination(long timeout, TimeUnit unit)voidclose()voidexecute(Runnable command)booleaninEventLoop()booleaninEventLoop(Thread thread)<T> List<Future<T>>invokeAll(Collection<? extends Callable<T>> tasks)<T> List<Future<T>>invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)<T> TinvokeAny(Collection<? extends Callable<T>> tasks)<T> TinvokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)booleanisShutdown()booleanisShuttingDown()booleanisTerminated()Iterator<io.netty.util.concurrent.EventExecutor>iterator()<V> io.netty.util.concurrent.Future<V>newFailedFuture(Throwable cause)<V> io.netty.util.concurrent.ProgressivePromise<V>newProgressivePromise()<V> io.netty.util.concurrent.Promise<V>newPromise()<V> io.netty.util.concurrent.Future<V>newSucceededFuture(V result)io.netty.channel.EventLoopnext()io.netty.channel.EventLoopGroupparent()io.netty.channel.ChannelFutureregister(io.netty.channel.Channel channel)io.netty.channel.ChannelFutureregister(io.netty.channel.ChannelPromise promise)io.netty.channel.ChannelFutureregister(io.netty.channel.Channel channel, io.netty.channel.ChannelPromise promise)io.netty.util.concurrent.ScheduledFuture<?>schedule(Runnable command, long delay, TimeUnit unit)<V> io.netty.util.concurrent.ScheduledFuture<V>schedule(Callable<V> callable, long delay, TimeUnit unit)io.netty.util.concurrent.ScheduledFuture<?>scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)io.netty.util.concurrent.ScheduledFuture<?>scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit)voidshutdown()io.netty.util.concurrent.Future<?>shutdownGracefully()io.netty.util.concurrent.Future<?>shutdownGracefully(long quietPeriod, long timeout, TimeUnit unit)List<Runnable>shutdownNow()io.netty.util.concurrent.Future<?>submit(Runnable task)<T> io.netty.util.concurrent.Future<T>submit(Runnable task, T result)<T> io.netty.util.concurrent.Future<T>submit(Callable<T> task)io.netty.util.concurrent.Future<?>terminationFuture()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
ExecutorNettyAdapter
public ExecutorNettyAdapter(ArtemisExecutor executor)
-
-
Method Detail
-
parent
public io.netty.channel.EventLoopGroup parent()
- Specified by:
parentin interfaceio.netty.util.concurrent.EventExecutor- Specified by:
parentin interfaceio.netty.channel.EventLoop
-
next
public io.netty.channel.EventLoop next()
- Specified by:
nextin interfaceio.netty.util.concurrent.EventExecutor- Specified by:
nextin interfaceio.netty.util.concurrent.EventExecutorGroup- Specified by:
nextin interfaceio.netty.channel.EventLoopGroup
-
register
public io.netty.channel.ChannelFuture register(io.netty.channel.Channel channel)
- Specified by:
registerin interfaceio.netty.channel.EventLoopGroup
-
register
public io.netty.channel.ChannelFuture register(io.netty.channel.ChannelPromise promise)
- Specified by:
registerin interfaceio.netty.channel.EventLoopGroup
-
register
public io.netty.channel.ChannelFuture register(io.netty.channel.Channel channel, io.netty.channel.ChannelPromise promise)- Specified by:
registerin interfaceio.netty.channel.EventLoopGroup
-
inEventLoop
public boolean inEventLoop()
- Specified by:
inEventLoopin interfaceio.netty.util.concurrent.EventExecutor
-
inEventLoop
public boolean inEventLoop(Thread thread)
- Specified by:
inEventLoopin interfaceio.netty.util.concurrent.EventExecutor
-
newPromise
public <V> io.netty.util.concurrent.Promise<V> newPromise()
- Specified by:
newPromisein interfaceio.netty.util.concurrent.EventExecutor
-
newProgressivePromise
public <V> io.netty.util.concurrent.ProgressivePromise<V> newProgressivePromise()
- Specified by:
newProgressivePromisein interfaceio.netty.util.concurrent.EventExecutor
-
newSucceededFuture
public <V> io.netty.util.concurrent.Future<V> newSucceededFuture(V result)
- Specified by:
newSucceededFuturein interfaceio.netty.util.concurrent.EventExecutor
-
newFailedFuture
public <V> io.netty.util.concurrent.Future<V> newFailedFuture(Throwable cause)
- Specified by:
newFailedFuturein interfaceio.netty.util.concurrent.EventExecutor
-
isShuttingDown
public boolean isShuttingDown()
- Specified by:
isShuttingDownin interfaceio.netty.util.concurrent.EventExecutorGroup
-
shutdownGracefully
public io.netty.util.concurrent.Future<?> shutdownGracefully()
- Specified by:
shutdownGracefullyin interfaceio.netty.util.concurrent.EventExecutorGroup
-
shutdownGracefully
public io.netty.util.concurrent.Future<?> shutdownGracefully(long quietPeriod, long timeout, TimeUnit unit)- Specified by:
shutdownGracefullyin interfaceio.netty.util.concurrent.EventExecutorGroup
-
terminationFuture
public io.netty.util.concurrent.Future<?> terminationFuture()
- Specified by:
terminationFuturein interfaceio.netty.util.concurrent.EventExecutorGroup
-
shutdown
public void shutdown()
- Specified by:
shutdownin interfaceio.netty.util.concurrent.EventExecutorGroup- Specified by:
shutdownin interfaceExecutorService
-
shutdownNow
public List<Runnable> shutdownNow()
- Specified by:
shutdownNowin interfaceio.netty.util.concurrent.EventExecutorGroup- Specified by:
shutdownNowin interfaceExecutorService
-
iterator
public Iterator<io.netty.util.concurrent.EventExecutor> iterator()
-
submit
public io.netty.util.concurrent.Future<?> submit(Runnable task)
- Specified by:
submitin interfaceio.netty.util.concurrent.EventExecutorGroup- Specified by:
submitin interfaceExecutorService
-
submit
public <T> io.netty.util.concurrent.Future<T> submit(Runnable task, T result)
- Specified by:
submitin interfaceio.netty.util.concurrent.EventExecutorGroup- Specified by:
submitin interfaceExecutorService
-
submit
public <T> io.netty.util.concurrent.Future<T> submit(Callable<T> task)
- Specified by:
submitin interfaceio.netty.util.concurrent.EventExecutorGroup- Specified by:
submitin interfaceExecutorService
-
schedule
public io.netty.util.concurrent.ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit)
- Specified by:
schedulein interfaceio.netty.util.concurrent.EventExecutorGroup- Specified by:
schedulein interfaceScheduledExecutorService
-
schedule
public <V> io.netty.util.concurrent.ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit)
- Specified by:
schedulein interfaceio.netty.util.concurrent.EventExecutorGroup- Specified by:
schedulein interfaceScheduledExecutorService
-
scheduleAtFixedRate
public io.netty.util.concurrent.ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)
- Specified by:
scheduleAtFixedRatein interfaceio.netty.util.concurrent.EventExecutorGroup- Specified by:
scheduleAtFixedRatein interfaceScheduledExecutorService
-
scheduleWithFixedDelay
public io.netty.util.concurrent.ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit)
- Specified by:
scheduleWithFixedDelayin interfaceio.netty.util.concurrent.EventExecutorGroup- Specified by:
scheduleWithFixedDelayin interfaceScheduledExecutorService
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdownin interfaceExecutorService
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminatedin interfaceExecutorService
-
awaitTermination
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException- Specified by:
awaitTerminationin interfaceExecutorService- Throws:
InterruptedException
-
invokeAll
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException
- Specified by:
invokeAllin interfaceExecutorService- Throws:
InterruptedException
-
invokeAll
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException
- Specified by:
invokeAllin interfaceExecutorService- Throws:
InterruptedException
-
invokeAny
public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException
- Specified by:
invokeAnyin interfaceExecutorService- Throws:
InterruptedExceptionExecutionException
-
invokeAny
public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
- Specified by:
invokeAnyin interfaceExecutorService- Throws:
InterruptedExceptionExecutionExceptionTimeoutException
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable
-
-