Class ActionHandler

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.SimpleChannelInboundHandler<InboundMessageType>
google.registry.monitoring.blackbox.handler.ActionHandler
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler
Direct Known Subclasses:
EppActionHandler, WebWhoisActionHandler

public abstract class ActionHandler extends io.netty.channel.SimpleChannelInboundHandler<InboundMessageType>
Superclass of all ChannelHandlers placed at end of channel pipeline

ActionHandler inherits from SimpleChannelInboundHandler, as it should only be passed in messages that implement the InboundMessageType interface.

The ActionHandler skeleton exists for a few main purposes. First, it returns a ChannelPromise, which informs the ProbingAction in charge that a response has been read. Second, with any exception thrown, the connection is closed, and the ProbingAction governing this channel is informed of the error. If the error is an instance of a FailureException finished is marked as a failure with cause FailureException. If it is any other type of error, it is treated as an UndeterminedStateException and finished set as a failure with the same cause as what caused the exception. Lastly, if no error is thrown, we know the action completed as a success, and, as such, we mark finished as a success.

Subclasses specify further work to be done for specific kinds of channel pipelines.

  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

    io.netty.channel.ChannelHandler.Sharable
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected io.netty.channel.ChannelPromise
    ChannelPromise that informs ProbingAction if response has been received.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    channelRead0(io.netty.channel.ChannelHandlerContext ctx, InboundMessageType inboundMessage)
    Marks ChannelPromise as success
    void
    exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)
    Logs the channel and pipeline that caused error, closes channel, then informs ProbingAction listeners of error.
    io.netty.channel.ChannelFuture
    Returns initialized ChannelPromise to ProbingAction.
    void
    handlerAdded(io.netty.channel.ChannelHandlerContext ctx)
    Initializes ChannelPromise

    Methods inherited from class io.netty.channel.SimpleChannelInboundHandler

    acceptInboundMessage, channelRead

    Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

    channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered

    Methods inherited from class io.netty.channel.ChannelHandlerAdapter

    ensureNotSharable, handlerRemoved, isSharable

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.netty.channel.ChannelHandler

    handlerRemoved
  • Field Details

    • finished

      protected io.netty.channel.ChannelPromise finished
      ChannelPromise that informs ProbingAction if response has been received.
  • Constructor Details

    • ActionHandler

      public ActionHandler()
  • Method Details

    • getFinishedFuture

      public io.netty.channel.ChannelFuture getFinishedFuture()
      Returns initialized ChannelPromise to ProbingAction.
    • handlerAdded

      public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx)
      Initializes ChannelPromise
      Specified by:
      handlerAdded in interface io.netty.channel.ChannelHandler
      Overrides:
      handlerAdded in class io.netty.channel.ChannelHandlerAdapter
    • channelRead0

      public void channelRead0(io.netty.channel.ChannelHandlerContext ctx, InboundMessageType inboundMessage) throws FailureException, UndeterminedStateException
      Marks ChannelPromise as success
      Specified by:
      channelRead0 in class io.netty.channel.SimpleChannelInboundHandler<InboundMessageType>
      Throws:
      FailureException
      UndeterminedStateException
    • exceptionCaught

      public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)
      Logs the channel and pipeline that caused error, closes channel, then informs ProbingAction listeners of error.
      Specified by:
      exceptionCaught in interface io.netty.channel.ChannelHandler
      Specified by:
      exceptionCaught in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      exceptionCaught in class io.netty.channel.ChannelInboundHandlerAdapter