Class ProbingAction
- All Implemented Interfaces:
Callable<io.netty.channel.ChannelFuture>
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
Modifier and TypeClassDescriptionstatic class
AutoValue.Builder
that does work of creating connection when not already present. -
Field Summary
Modifier and TypeFieldDescriptionstatic final io.netty.util.AttributeKey
<io.netty.channel.ChannelFuture> AttributeKey
in channel that givesChannelFuture
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
-
Method Summary
Modifier and TypeMethodDescriptionstatic ProbingAction.Builder
builder()
io.netty.channel.ChannelFuture
call()
Performs the work of the actual action.abstract io.netty.channel.Channel
channel()
Channel
object that is either created by or passed into thisProbingAction
instanceabstract org.joda.time.Duration
delay()
ActualDuration
of this delayabstract String
host()
The hostname of the remote host we have a connection or will make a connection toabstract OutboundMessageType
OutboundMessageType
instance that we write and flush down pipeline to serverabstract Protocol
protocol()
TheProtocol
instance that specifies type of connectionfinal String
toString()
-
Field Details
-
CONNECTION_FUTURE_KEY
public static final io.netty.util.AttributeKey<io.netty.channel.ChannelFuture> CONNECTION_FUTURE_KEYAttributeKey
in channel that givesChannelFuture
that is set to success when channel is active. -
REMOTE_ADDRESS_KEY
AttributeKey
in channel that gives the information of the channel's host.
-
-
Constructor Details
-
ProbingAction
public ProbingAction()
-
-
Method Details
-
builder
-
delay
public abstract org.joda.time.Duration delay()ActualDuration
of this delay -
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 thisProbingAction
instance -
protocol
TheProtocol
instance that specifies type of connection -
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 theProbingStep
of this. -
toString
-