public boolean writeSilenceForced ( SIMPMessage m ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "writeSilenceForced" , new Object [ ] { m } ) ; boolean msgRemoved = true ; JsMessage jsMsg = m . getMessage ( ) ; long start = jsMsg . getGuaranteedValueStartTick ( ) ; long end = jsMsg . getGuaranteedValueEndTick ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { SibTr . debug ( tc , "writeSilenceForced from: " + start + " to " + end + " on Stream " + stream ) ; } TickRange tr = new TickRange ( TickRange . Completed , start , end ) ; // used to send message if it moves inside inDoubt window List sendList = null ; synchronized ( this ) { // If the tick of the new silence has already been set to completed then // the message must already have been processed (either sent+acked or already // silenced) either way, we should class it as a 'removed' message. // This fixes a problem where a message is nacked,sent and acked all in the // window between setting it as a value and actually trying to lock it (in PtoPOutputHandler) // prior to sending it. In this situation, the message no longer exists in the // MsgStore, so PtoPOutputHandler believed it had expired, which then calls this // method to try to remove it - decrementing the totalMessage count and messing // up future sendWindow calculations (which can leave messages left unsent). if ( end <= getCompletedPrefix ( ) ) { msgRemoved = false ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Message " + end + " already completed" , m ) ; } else { oststream . writeCompletedRangeForced ( tr ) ; // Check whether removing this message means we have // a message to send TickRange str = null ; if ( ( str = msgRemoved ( jsMsg . getGuaranteedValueValueTick ( ) , oststream , null ) ) != null ) { sendList = new LinkedList ( ) ; sendList . add ( str ) ; if ( str . valuestamp > lastMsgSent ) lastMsgSent = str . valuestamp ; } } } // Do the send outside of the synchronise if ( sendList != null ) { sendMsgs ( sendList , false ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "writeSilenceForced" , Boolean . valueOf ( msgRemoved ) ) ; return msgRemoved ; }
This method uses a Value message to write Silence into the stream because a message which was a Guess is being removed from the stream It forces the stream to be updated to Silence without checking the existing state