Skip navigation

Netty 4.0.0.CR2 released

It's my pleasure to announce the second release candidate for Netty 4.0.0. Unfortunately, there is some API-breakage when upgrading from the previous release. We had to do this to eliminate some design issues which were found by users. Please read this post before an upgrade.

Thanks again to everyone who helped us fix issues and make the release even more stable.

You can grab the release from our download page and from the Maven central repository.

If you have any feedback please let us know, we really appreciate them.

Backward-incompatible changes

Please read this section before upgrading to CR2.

ChannelHandler and its sub-types

  • ChannelHandler.beforeAdd/Remove(...) was removed because it made it very difficult to fulfill the thread model while not blocking at all.
  • ChannelHandler.afterAdd/Remove(...) was renamed to handlerAdded/Removed(...).

This may not affect any of your code if you not made use of those and just extended the Adapter classes.

ChannelInbound/OutboundHandler and its sub-types

  • Removed ChannelInboundHandler.freeInboundBuffer() and ChannelOutboundHandler.freeOutboundBuffer() because it's not useful anymore since we introduced reference counting in the previous releases.

This may not affect any of your code because you usually extend *Adapters and don't override the mentioned methods.

Codec framework

  • encode(...) and decode(...) now take a MessageBuf<Object> as a parameter and return void. Therefore, once you encoded or decoded a message, you have to add the message to the MessageBuf<Object> given as a parameter. This change simplifies message handling by enabling the removal of automatic array unfolding.

This will most likely affect you if you wrote a codec based on the codec framework.

SslHandler

  • SslHandler.handshake() was renamed to handshakeFuture() for consistency. Also, it now returns a Future<Channel> instead of a ChannelFuture.
  • SslHandler.closeNotifyFutre() returns a Future<Channel> instead of a ChannelFuture.

ByteBufHolder and its sub-types

  • ByteBufHolder.data() was renamed to content(). The sub-types, for instance, include HttpContent, SctpMessage, SpdyDataFrame, and WebSocketFrame.

ChannelPipeline

  • ChannelPipeline.remove/replaceAndForward(...) has been merged into remove/replace().

Bootstrap and ServerBootstrap

  • ServerBootstrap.shutdown() and Bootstrap.shutdown() were deprecated. Please use the EventExecutorGroup.shutdownGracefully() method instead. See the next section for more information.

EventExecutorGroup and EventLoopGroup

  • Fixed the API contract violation against java.util.concurrent.ExecutorService with respect to the Executor life cycle.
  • EventExecutorGroup.shutdown() has been deprecated by shutdownGracefully(). Use shutdownGracefully() wherever possible to avoid any trouble such as resource leak during a shutdown.

Changes in general

This release fixed 90 issues. It's highly recommended to upgrade as soon as possible. We'd like to apologize that the upgrade process might not be as smooth as 'dropping the new JAR', but we believe all the changes were really worth the pain before going final.

Besides all the fixes, this release also ships with a few new features which may be worth some more details:

  • #762 adds WebSockeClientHandler which makes it super easy to write WebSocket clients with Netty. See the apidocs for more details.
  • #1207 adds WebSocketFrameAggregator which can be used to aggregate partial frames.
  • #1244 allows to pass DefaultChannelTransferPromise to sendFile(..) operation to keep track of the transfer progress.

Visit here for the complete list of the changes.