MCPcopy Create free account
hub / github.com/grpc/grpc-java / addCallback

Method addCallback

core/src/main/java/io/grpc/internal/Http2Ping.java:94–106  ·  view source on GitHub ↗

Registers a callback that is invoked when the ping operation completes. If this ping operation is already completed, the callback is invoked immediately. @param callback the callback to invoke @param executor the executor to use

(final ClientTransport.PingCallback callback, Executor executor)

Source from the content-addressed store, hash-verified

92 * @param executor the executor to use
93 */
94 public void addCallback(final ClientTransport.PingCallback callback, Executor executor) {
95 Runnable runnable;
96 synchronized (this) {
97 if (!completed) {
98 callbacks.put(callback, executor);
99 return;
100 }
101 // otherwise, invoke callback immediately (but not while holding lock)
102 runnable = this.failureCause != null ? asRunnable(callback, failureCause)
103 : asRunnable(callback, roundTripTimeNanos);
104 }
105 doExecute(executor, runnable);
106 }
107
108 /**
109 * Returns the expected ping payload for this outstanding operation.

Callers 15

pingMethod · 0.95
handlerAdded0Method · 0.45
runQpsMethod · 0.45
callEchoMethod · 0.45
futureCallCallbackMethod · 0.45
futureCallCallbackMethod · 0.45
futureCallCallbackMethod · 0.45
echoFutureMethod · 0.45
onQueryCompleteMethod · 0.45
checkAuthorizationMethod · 0.45
preAuthorizeMethod · 0.45

Calls 3

asRunnableMethod · 0.95
doExecuteMethod · 0.95
putMethod · 0.65

Tested by 2

runQpsMethod · 0.36
callEchoMethod · 0.36