private void parseResponseMessageSync ( ) throws IOException { // if read buffers are available, then attempt a parse otherwise go // into the "read data then parse" loop if ( isReadDataAvailable ( ) ) { try { // if data is already available, don't modify the buffer if ( parseMessage ( ) ) { this . numResponsesReceived ++ ; return ; } } catch ( IOException ioe ) { // no FFDC required if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "IOException while parsing response: " + ioe ) ; } throw ioe ; } catch ( Exception e ) { // no FFDC required if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Exception while parsing response: " + e ) ; } throw new IOException ( e . getMessage ( ) , e ) ; } } // keep reading and parsing until we're done while ( true ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Reading for data to parse" ) ; } try { // configure the buffers for reading setupReadBuffers ( getHttpConfig ( ) . getIncomingHdrBufferSize ( ) , false ) ; getTSC ( ) . getReadInterface ( ) . read ( 1 , getReadTimeout ( ) ) ; } catch ( IOException ioe ) { // no FFDC required if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Exception while reading response: " + ioe ) ; } reConnect ( ioe ) ; } try { if ( parseMessage ( ) ) { // finished parsing the message this . numResponsesReceived ++ ; return ; } } catch ( IOException ioe ) { // no FFDC required if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "IOException while parsing response: " + ioe ) ; } throw ioe ; } catch ( Exception e ) { // no FFDC required if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Exception while parsing response: " + e ) ; } throw new IOException ( e . getMessage ( ) , e ) ; } } }
Method to read for a response message synchronously . This will return when the message headers are completely parsed or throw an exception if an error occurs . This method does not contain any logic on what to do with the response it just wraps the reading and parsing stage .