netty5/common/src/main/java/io/netty/util/concurrent
Norman Maurer 3d6e6136a9
Decouple EventLoop details from the IO handling for each transport to… (#8680)
* Decouble EventLoop details from the IO handling for each transport to allow easy re-use of code and customization

Motiviation:

As today extending EventLoop implementations to add custom logic / metrics / instrumentations is only possible in a very limited way if at all. This is due the fact that most implementations are final or even package-private. That said even if these would be public there are the ability to do something useful with these is very limited as the IO processing and task processing are very tightly coupled. All of the mentioned things are a big pain point in netty 4.x and need improvement.

Modifications:

This changeset decoubled the IO processing logic from the task processing logic for the main transport (NIO, Epoll, KQueue) by introducing the concept of an IoHandler. The IoHandler itself is responsible to wait for IO readiness and process these IO events. The execution of the IoHandler itself is done by the SingleThreadEventLoop as part of its EventLoop processing. This allows to use the same EventLoopGroup (MultiThreadEventLoupGroup) for all the mentioned transports by just specify a different IoHandlerFactory during construction.

Beside this core API change this changeset also allows to easily extend SingleThreadEventExecutor / SingleThreadEventLoop to add custom logic to it which then can be reused by all the transports. The ideas are very similar to what is provided by ScheduledThreadPoolExecutor (that is part of the JDK). This allows for example things like:

  * Adding instrumentation / metrics:
    * how many Channels are registered on an SingleThreadEventLoop
    * how many Channels were handled during the IO processing in an EventLoop run
    * how many task were handled during the last EventLoop / EventExecutor run
    * how many outstanding tasks we have
    ...
    ...
  * Implementing custom strategies for choosing the next EventExecutor / EventLoop to use based on these metrics.
  * Use different Promise / Future / ScheduledFuture implementations
  * decorate Runnable / Callables when submitted to the EventExecutor / EventLoop

As a lot of functionalities are folded into the MultiThreadEventLoopGroup and SingleThreadEventLoopGroup this changeset also removes:

  * AbstractEventLoop
  * AbstractEventLoopGroup
  * EventExecutorChooser
  * EventExecutorChooserFactory
  * DefaultEventLoopGroup
  * DefaultEventExecutor
  * DefaultEventExecutorGroup

Result:

Fixes https://github.com/netty/netty/issues/8514 .
2019-01-23 08:32:05 +01:00
..
AbstractEventExecutor.java Decouple EventLoop details from the IO handling for each transport to… (#8680) 2019-01-23 08:32:05 +01:00
AbstractEventExecutorGroup.java Synchronized between 4.1 and master 2014-04-25 00:38:02 +09:00
AbstractFuture.java AbstractFuture should not wrap CancellationException 2015-12-11 10:24:08 -08:00
AbstractScheduledEventExecutor.java Decouple EventLoop details from the IO handling for each transport to… (#8680) 2019-01-23 08:32:05 +01:00
BlockingOperationException.java [#1065] Provide Future/Promise without channel reference 2013-03-07 07:21:37 +01:00
CompleteFuture.java Add java-doc for implemented methods of io.netty.util.concurrent.Future#cancel(boolean mayInterruptIfRunning) 2018-01-29 11:19:52 +01:00
DefaultEventExecutorGroup.java Decouple EventLoop details from the IO handling for each transport to… (#8680) 2019-01-23 08:32:05 +01:00
DefaultFutureListeners.java Fix most inspector warnings 2014-07-02 19:55:07 +09:00
DefaultProgressivePromise.java Update HttpStaticFileServer example / Fix bugs related with progress notification 2013-07-19 13:21:32 +09:00
DefaultPromise.java DefaultPromise.getNow() does not correctly handle DefaultPromise.setUncancellable() (#8154) 2018-07-27 01:55:21 +08:00
DefaultThreadFactory.java Dont use ThreadDeathWatcher to cleanup PoolThreadCache if FastThreadLocalThread with wrapped Runnable is used 2017-11-28 13:43:28 +01:00
EventExecutor.java Decouple EventLoop details from the IO handling for each transport to… (#8680) 2019-01-23 08:32:05 +01:00
EventExecutorGroup.java fix the typos 2017-04-20 04:56:09 +02:00
FailedFuture.java Let EventExecutor return our Future to allow the user to work also with FutureListener here. Also add a special ScheduledFuture that extends our Future for this purpose. 2013-03-19 10:45:42 +01:00
FastThreadLocal.java Java 8 migration: Use diamond operator (#8749) 2019-01-22 16:07:26 +01:00
FastThreadLocalRunnable.java Dont use ThreadDeathWatcher to cleanup PoolThreadCache if FastThreadLocalThread with wrapped Runnable is used 2017-11-28 13:43:28 +01:00
FastThreadLocalThread.java Introduce ObjectCleaner and use it in FastThreadLocal to ensure FastThreadLocal.onRemoval(...) is called 2017-12-21 07:34:44 +01:00
Future.java Clarify Future.removeListener[s] javaDocs 2016-06-08 15:48:26 -07:00
FutureListener.java Let EventExecutor return our Future to allow the user to work also with FutureListener here. Also add a special ScheduledFuture that extends our Future for this purpose. 2013-03-19 10:45:42 +01:00
GenericFutureListener.java Let EventExecutor return our Future to allow the user to work also with FutureListener here. Also add a special ScheduledFuture that extends our Future for this purpose. 2013-03-19 10:45:42 +01:00
GenericProgressiveFutureListener.java Implement ProgressivePromise notification in NIO byte channels and ChunkedWriteHandler 2013-07-19 12:53:23 +09:00
GlobalEventExecutor.java Decouple EventLoop details from the IO handling for each transport to… (#8680) 2019-01-23 08:32:05 +01:00
ImmediateEventExecutor.java Decouple EventLoop details from the IO handling for each transport to… (#8680) 2019-01-23 08:32:05 +01:00
ImmediateExecutor.java [#1369] Move ImmediateEventExecutor to common and let it access via a static 2013-05-17 21:35:01 +02:00
MultithreadEventExecutorGroup.java Decouple EventLoop details from the IO handling for each transport to… (#8680) 2019-01-23 08:32:05 +01:00
NonStickyEventExecutorGroup.java Decouple EventLoop details from the IO handling for each transport to… (#8680) 2019-01-23 08:32:05 +01:00
OrderedEventExecutor.java [#5486] Not operate on serial execution assumption when using EventExecutor in the DefaultChannelPipeline. 2016-07-07 15:01:56 +02:00
package-info.java [#1065] Provide Future/Promise without channel reference 2013-03-07 07:21:37 +01:00
ProgressiveFuture.java Make EventExecutor.shutdownGracefully() return Future 2013-06-12 08:00:54 +09:00
ProgressivePromise.java Make EventExecutor.shutdownGracefully() return Future 2013-06-12 08:00:54 +09:00
Promise.java Make EventExecutor.shutdownGracefully() return Future 2013-06-12 08:00:54 +09:00
PromiseAggregator.java Java 8 migration: Use diamond operator (#8749) 2019-01-22 16:07:26 +01:00
PromiseCombiner.java Restore add(Promise) and addAll(Promise...) methods to PromiseCombiner. 2017-01-30 09:23:11 +01:00
PromiseNotifier.java Log more details if notification of promise fails in PromiseNotifier and AbstractChannelHandlerContext 2016-09-07 06:55:38 +02:00
PromiseTask.java Decouple EventLoop details from the IO handling for each transport to… (#8680) 2019-01-23 08:32:05 +01:00
RejectedExecutionHandler.java Allow to inject RejectedExecutionHandler for different EventLoops and EventExecutors 2016-06-24 17:08:30 +02:00
RejectedExecutionHandlers.java fix the typos 2017-04-20 04:56:09 +02:00
RunnableFuture.java Decouple EventLoop details from the IO handling for each transport to… (#8680) 2019-01-23 08:32:05 +01:00
RunnableFutureAdapter.java Decouple EventLoop details from the IO handling for each transport to… (#8680) 2019-01-23 08:32:05 +01:00
RunnableScheduledFuture.java Decouple EventLoop details from the IO handling for each transport to… (#8680) 2019-01-23 08:32:05 +01:00
RunnableScheduledFutureAdapter.java Decouple EventLoop details from the IO handling for each transport to… (#8680) 2019-01-23 08:32:05 +01:00
ScheduledFuture.java Fix most inspector warnings 2014-07-02 19:55:07 +09:00
SingleThreadEventExecutor.java Decouple EventLoop details from the IO handling for each transport to… (#8680) 2019-01-23 08:32:05 +01:00
SucceededFuture.java Let EventExecutor return our Future to allow the user to work also with FutureListener here. Also add a special ScheduledFuture that extends our Future for this purpose. 2013-03-19 10:45:42 +01:00
ThreadPerTaskExecutor.java ability to use Executor instead of ThreadFactory 2014-02-13 16:14:41 -08:00
ThreadProperties.java Fix javadoc issues 2017-02-22 07:31:07 +01:00
UnaryPromiseNotifier.java PromiseNotifier does not propagate cancel events 2016-02-19 10:16:04 -08:00
UnorderedThreadPoolEventExecutor.java Decouple EventLoop details from the IO handling for each transport to… (#8680) 2019-01-23 08:32:05 +01:00