public void pingReceived ( Ping pong ) { long now = System . currentTimeMillis ( ) ; long previousPingTime = lastPingSentOn . get ( ) ; int previousPingValue = ( int ) ( previousPingTime & 0xffffffff L ) ; int pongValue = pong . getValue2 ( ) . intValue ( ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Pong received: session=[{}] at {} with value {}, previous received at {}" , new Object [ ] { getSessionId ( ) , now , pongValue , previousPingValue } ) ; } if ( pongValue == previousPingValue ) { lastPingRoundTripTime . set ( ( int ) ( ( now - previousPingTime ) & 0xffffffff L ) ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Ping response session=[{}], RTT=[{} ms]" , new Object [ ] { getSessionId ( ) , lastPingRoundTripTime . get ( ) } ) ; } } else { // don't log the congestion entry unless there are more than X messages waiting if ( getPendingMessages ( ) > 4 ) { int pingRtt = ( int ) ( ( now & 0xffffffff L ) ) - pongValue ; log . info ( "Pong delayed: session=[{}], ping response took [{} ms] to arrive. Connection may be congested, or loopback" , new Object [ ] { getSessionId ( ) , pingRtt } ) ; } } lastPongReceivedOn . set ( now ) ; }
Marks that ping back was received .