public class Http2Ping extends Object
ClientTransport.ping(io.grpc.internal.ClientTransport.PingCallback, java.util.concurrent.Executor)
.
A typical transport need only support one outstanding ping at a time. So, if a ping is requested while an operation is already in progress, the given callback is notified when the existing operation completes.
Constructor and Description |
---|
Http2Ping(long data,
Stopwatch stopwatch)
Creates a new ping operation.
|
Modifier and Type | Method and Description |
---|---|
void |
addCallback(ClientTransport.PingCallback callback,
Executor executor)
Registers a callback that is invoked when the ping operation completes.
|
boolean |
complete()
Completes this operation successfully.
|
void |
failed(Throwable failureCause)
Completes this operation exceptionally.
|
static void |
notifyFailed(ClientTransport.PingCallback callback,
Executor executor,
Throwable cause)
Notifies the given callback that the ping operation failed.
|
long |
payload()
Returns the expected ping payload for this outstanding operation.
|
public Http2Ping(long data, Stopwatch stopwatch)
data
- the ping payloadstopwatch
- a stopwatch for measuring round-trip timepublic void addCallback(ClientTransport.PingCallback callback, Executor executor)
callback
- the callback to invokeexecutor
- the executor to usepublic long payload()
public boolean complete()
public void failed(Throwable failureCause)
failureCause
- the cause of failurepublic static void notifyFailed(ClientTransport.PingCallback callback, Executor executor, Throwable cause)
callback
- the callbackexecutor
- the executor used to invoke the callbackcause
- the cause of failure