Class ProbingAction

java.lang.Object
google.registry.monitoring.blackbox.connection.ProbingAction
All Implemented Interfaces:
Callable<io.netty.channel.ChannelFuture>

public abstract class ProbingAction extends Object implements Callable<io.netty.channel.ChannelFuture>
AutoValue class that represents action generated by ProbingStep

Inherits from Callable, as it has can be called to perform its specified task, and return the ChannelFuture that will be informed when the task has been completed

Is an immutable class, as it is comprised of the tools necessary for making a specific type of connection. It goes hand in hand with Protocol, which specifies the kind of overall connection to be made. Protocol gives the outline and ProbingAction gives the details of that connection.

In its build, if there is no channel supplied, it will create a channel from the attributes already supplied. Then, it only sends the OutboundMessageType down the pipeline when informed that the connection is successful. If the channel is supplied, the connection future is automatically set to successful.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    AutoValue.Builder that does work of creating connection when not already present.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final io.netty.util.AttributeKey<io.netty.channel.ChannelFuture>
    AttributeKey in channel that gives ChannelFuture that is set to success when channel is active.
    static final io.netty.util.AttributeKey<String>
    AttributeKey in channel that gives the information of the channel's host.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    io.netty.channel.ChannelFuture
    Performs the work of the actual action.
    abstract io.netty.channel.Channel
    Channel object that is either created by or passed into this ProbingAction instance
    abstract org.joda.time.Duration
    Actual Duration of this delay
    abstract String
    The hostname of the remote host we have a connection or will make a connection to
    OutboundMessageType instance that we write and flush down pipeline to server
    abstract Protocol
    The Protocol instance that specifies type of connection
    final String
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • CONNECTION_FUTURE_KEY

      public static final io.netty.util.AttributeKey<io.netty.channel.ChannelFuture> CONNECTION_FUTURE_KEY
      AttributeKey in channel that gives ChannelFuture that is set to success when channel is active.
    • REMOTE_ADDRESS_KEY

      public static final io.netty.util.AttributeKey<String> REMOTE_ADDRESS_KEY
      AttributeKey in channel that gives the information of the channel's host.
  • Constructor Details

    • ProbingAction

      public ProbingAction()
  • Method Details

    • builder

      public static ProbingAction.Builder builder()
    • delay

      public abstract org.joda.time.Duration delay()
      Actual Duration of this delay
    • outboundMessage

      public abstract OutboundMessageType outboundMessage()
      OutboundMessageType instance that we write and flush down pipeline to server
    • channel

      public abstract io.netty.channel.Channel channel()
      Channel object that is either created by or passed into this ProbingAction instance
    • protocol

      public abstract Protocol protocol()
      The Protocol instance that specifies type of connection
    • host

      public abstract String host()
      The hostname of the remote host we have a connection or will make a connection to
    • call

      public io.netty.channel.ChannelFuture call()
      Performs the work of the actual action.

      First, checks if channel is active by setting a listener to perform the bulk of the work when the connection future is successful.

      Once the connection is successful, we establish which of the handlers in the pipeline is the ActionHandler.From that, we can obtain a future that is marked as a success when we receive an expected response from the server.

      Next, we set a timer set to a specified delay. After the delay has passed, we send the outboundMessage down the channel pipeline, and when we observe a success or failure, we inform the ProbingStep of this.

      Specified by:
      call in interface Callable<io.netty.channel.ChannelFuture>
      Returns:
      ChannelFuture that denotes when the action has been successfully performed.
    • toString

      public final String toString()
      Overrides:
      toString in class Object