Class ChannelTaskSerializer

java.lang.Object
com.linkedin.alpini.netty4.misc.ChannelTaskSerializer

public class ChannelTaskSerializer extends Object
The purpose of this class is to execute tasks in series without overlap, even if the executeTask(Consumer, ChannelFutureListener) method is called before the completion if the previous tasks. The next task is not started until after the provided ChannelFutureListener returns. If the task fails to complete by completing the ChannelPromise, the serializer becomes blocked. It may be possible to add a PhantomReference to detect when the ChannelPromise completion has been lost and to enact some kind of recovery.
  • Constructor Details

    • ChannelTaskSerializer

      public ChannelTaskSerializer(@Nonnull io.netty.channel.ChannelHandlerContext ctx)
  • Method Details

    • executeTask

      public void executeTask(@Nonnull Consumer<io.netty.channel.ChannelPromise> task, @Nonnull io.netty.channel.ChannelFutureListener listener)