private boolean sendEntireMessage ( SIBusMessage sibMessage , List < DataSlice > messageSlices , boolean lastMsg , Integer priority ) throws MessageEncodeFailedException , IncorrectMessageTypeException , MessageCopyFailedException , UnsupportedEncodingException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "sendEntireMessage" , new Object [ ] { sibMessage , messageSlices , lastMsg , priority } ) ; if ( lastMsg ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Sending last in batch" ) ; } ConversationState convState = ( ConversationState ) getConversation ( ) . getAttachment ( ) ; // Flag to indicate a Comms error so that we stop sending messages boolean ok = true ; try { CommsServerByteBuffer byteBuffer = poolManager . allocate ( ) ; int msgLen = 0 ; short msgFlags = CommsConstants . ASYNC_START_OR_MID_BATCH ; if ( lastMsg ) msgFlags |= CommsConstants . ASYNC_LAST_IN_BATCH ; byteBuffer . putShort ( convState . getConnectionObjectId ( ) ) ; byteBuffer . putShort ( mainConsumer . getClientSessionId ( ) ) ; byteBuffer . putShort ( msgFlags ) ; byteBuffer . putShort ( mainConsumer . getMessageBatchNumber ( ) ) ; // BIT16 Message Batch // Put the entire message into the buffer in whatever way is suitable if ( messageSlices == null ) { msgLen = byteBuffer . putMessage ( ( JsMessage ) sibMessage , convState . getCommsConnection ( ) , getConversation ( ) ) ; } else { msgLen = byteBuffer . putMessgeWithoutEncode ( messageSlices ) ; } int jfapPriority = JFapChannelConstants . getJFAPPriority ( priority ) ; getConversation ( ) . send ( byteBuffer , JFapChannelConstants . SEG_ASYNC_MESSAGE , 0 , // No request number jfapPriority , false , ThrottlingPolicy . BLOCK_THREAD , null ) ; } catch ( SIException e ) { FFDCFilter . processException ( e , CLASS_NAME + ".sendEntireMessage" , CommsConstants . CATASYNCHCONSUMER_SENDENTIREMESS_01 , this ) ; ok = false ; SibTr . error ( tc , "COMMUNICATION_ERROR_SICO2017" , e ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "sendEntireMessage" , ok ) ; return ok ; }
Sends the message in one big buffer . If the messageSlices parameter is not null then the message has already been encoded and does not need to be done again . This may be in the case where the message was destined to be sent in chunks but is so small that it does not seem worth it .