microBean™ Jersey Netty Integration
Jersey can be run as a simple handler of sorts in a Netty pipeline. The Netty event loop remains unblocked, there is no locking, reads and writes involve no copying of byte arrays, output is streamed where appropriate and it is intended that there be as few object allocations as possible.
serverBootstrap.childHandler(new JerseyChannelInitializer(baseUri, sslContext, yourJaxRsApplication));
Background and Motivation
Note that this implementation cannot be more experimental.
There are several issues with this "native" Netty integration project.
The most problematic seems to be issue
3500. This issue
and others stem from the fact that the "native" Netty integration
project sets up its own internal queues for streaming, which overflow.
ByteBuffers are allocated throughout. It is also
not entirely clear if HTTP/2 is fully supported.
This implementation instead shares a
reading and writing, and makes heavy use of Netty's
while also ultimately ensuring that all operations on a given
ByteBuf that originate from Jersey are serialized to the Netty event
loop. This dramatically reduces object allocations, locks, threading
issues, exception handling pathways and other concurrency problems.