Future < Boolean > stop ( ) { this . startStopLock . lock ( ) ; try { this . running . set ( false ) ; this . outgoing . pause ( ) ; this . reconnectOutgoing . pause ( ) ; // Clear old ping/pong requests byte [ ] pingRequest = NatsConnection . OP_PING . getBytes ( StandardCharsets . UTF_8 ) ; byte [ ] pongRequest = NatsConnection . OP_PONG . getBytes ( StandardCharsets . UTF_8 ) ; this . outgoing . filter ( ( msg ) - > { return Arrays . equals ( pingRequest , msg . getProtocolBytes ( ) ) || Arrays . equals ( pongRequest , msg . getProtocolBytes ( ) ) ; } ) ; } finally { this . startStopLock . unlock ( ) ; } return this . stopped ; }
method does .