private void parsePrimaryOnlyPayload ( WsByteBuffer contextBuffer ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "parsePrimaryOnlyPayload" , contextBuffer ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) JFapUtils . debugTraceWsByteBufferInfo ( this , tc , contextBuffer , "contextBuffer" ) ; WsByteBuffer dispatchToConnectionData = null ; if ( ( unparsedPayloadData == null ) && ( transmissionPayloadDataLength > contextBuffer . remaining ( ) ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "allocating unparsed payload data area, size=" + transmissionPayloadDataLength ) ; unparsedPayloadData = allocateWsByteBuffer ( transmissionPayloadDataLength , false ) ; unparsedPayloadData . position ( 0 ) ; unparsedPayloadData . limit ( transmissionPayloadDataLength ) ; } if ( state != STATE_ERROR ) { if ( unparsedPayloadData != null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) JFapUtils . debugTraceWsByteBufferInfo ( this , tc , unparsedPayloadData , "unparsedPayloadData" ) ; dispatchToConnectionData = readData ( contextBuffer , unparsedPayloadData ) ; if ( dispatchToConnectionData != null ) { final boolean closed = dispatchToConnection ( dispatchToConnectionData ) ; if ( closed ) { //If this dispatch resulted in the connection closing we shouldn't expect any more data so break out of loop. needMoreData = true ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Connection closed, breaking out of loop" ) ; } reset ( ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "need more data" ) ; needMoreData = true ; } } else { int contextBufferPosition = contextBuffer . position ( ) ; int contextBufferLimit = contextBuffer . limit ( ) ; contextBuffer . limit ( contextBufferPosition + transmissionPayloadDataLength ) ; final boolean closed = dispatchToConnection ( contextBuffer ) ; if ( closed ) { //If this dispatch resulted in the connection closing we shouldn't expect any more data so break out of loop. needMoreData = true ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Connection closed, breaking out of loop" ) ; } else { contextBuffer . limit ( contextBufferLimit ) ; contextBuffer . position ( contextBufferPosition + transmissionPayloadDataLength ) ; } reset ( ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "parsePrimaryOnlyPayload" ) ; }
Invoked to parse a primary header payload structure from the supplied buffer . May be invoked multiple times to incrementally parse the structure . Once the structure has been fully parsed transitions the state machine into the appropriate next state based on the layout of the transmission .