@ Override public void writeSilence ( MessageItem m ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "writeSilence" , new Object [ ] { m } ) ; JsMessage jsMsg = m . getMessage ( ) ; // There may be Completed ticks after the Value, if so then // write these into the stream too long stamp = jsMsg . getGuaranteedValueValueTick ( ) ; long ends = jsMsg . getGuaranteedValueEndTick ( ) ; if ( ends < stamp ) ends = stamp ; TickRange tr = new TickRange ( TickRange . Completed , jsMsg . getGuaranteedValueStartTick ( ) , ends ) ; // Update the stream writeSilenceInternal ( tr , false ) ; /* * PM71430.DEV : We have to send the ACK control message for the messages which are to be silenced. * Otherwise, if for some reason, source side ME stops sending the ACKEXPECTED control messages, * target ME will never send ACK for these messages. This will result into messages getting piled * on the source ME and never get removed. * * ACK message is not sent for silence message. Instead, it is sent only after a gap of 50 (default) * messages from the last ACKED message. * * If any consumers come up in between, this method is not * called to write silence. In this case, ACK is always sent during batch commit call back. * * Please note this piece of code has been written to handle specific scenario when there are no * local consumers on the target side for a long time which results in never acknowledging any of * the ticks and the local completed prefix keeps moving ahead. */ long gapFromPreviousAck = ends - this . _lastAckedTick ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "gap from the previous ack: " + gapFromPreviousAck + " lastAckedTick: " + this . _lastAckedTick ) ; if ( gapFromPreviousAck >= this . ACK_GAP_FOR_SILENCE_TICKS ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "sending the ACK message for the batch of silence message " , new Object [ ] { m } ) ; sendAck ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "writeSilence" ) ; }
This method uses a Value message to write Silence into the stream because a message has been filtered out