public void addCallback ( final ClientTransport . PingCallback callback , Executor executor ) { Runnable runnable ; synchronized ( this ) { if ( ! completed ) { callbacks . put ( callback , executor ) ; return ; } // otherwise, invoke callback immediately (but not while holding lock) runnable = this . failureCause != null ? asRunnable ( callback , failureCause ) : asRunnable ( callback , roundTripTimeNanos ) ; } doExecute ( executor , runnable ) ; }
Registers a callback that is invoked when the ping operation completes . If this ping operation is already completed the callback is invoked immediately .