boolean addHandle ( SIMessageHandle handle , Map ctxInfo , final boolean canBeDeleted ) { final String methodName = "addHandle" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , new Object [ ] { handle , ctxInfo , canBeDeleted } ) ; } boolean addedToThisToken = false ; if ( _messageHandles . isEmpty ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { SibTr . debug ( TRACE , "No existing message handles - using current message as template <ctxInfo=" + ctxInfo + "> <canBeDeleted=" + canBeDeleted + "> <handle= " + handle + ">" ) ; } _messageHandles . add ( handle ) ; _contextInfo = ctxInfo ; _deleteMessagesWhenRead = canBeDeleted ; // Work out once whether this map is default size so we can optimize // the matches method later on. _contextInfoContainsDefaultEntries = ( _contextInfo . size ( ) == 2 //&& //lohith liberty change // _contextInfo.containsKey(WlmClassifierConstants.CONTEXT_MAP_KEY) && /* _contextInfo.containsKey(ExitPointConstants.TYPE_NAME)*/ ) ; addedToThisToken = true ; } else { if ( matches ( ctxInfo , canBeDeleted ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { SibTr . debug ( TRACE , "Message matched token for supplied handle - adding handle to the token <handle=" + handle + ">" ) ; } _messageHandles . add ( handle ) ; addedToThisToken = true ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName , addedToThisToken ) ; } return addedToThisToken ; }
Attemts to add the supplied message handle to the token . This is only done if the context information matches and both messages are BENP or both are not BENP .