On 13/05/2015 14:19, Rémy Maucherat wrote:
> 2015-05-13 0:29 GMT+02:00 <ma...@apache.org>:
> 
>> Author: markt
>> Date: Tue May 12 22:29:45 2015
>> New Revision: 1679116
>>
>> URL: http://svn.apache.org/r1679116
>> Log:
>> Start to process the initial settings frame sent by the client.
>> +    private boolean processFrame() throws IOException {
>> +        // TODO: Consider refactoring and making this a field to reduce
>> GC.
>> +        byte[] frameHeader = new byte[9];
>> +        if (!getFrameHeader(frameHeader)) {
>> +            return false;
>> +        }
>> +
>> +        int frameType = getFrameType(frameHeader);
>> +        int streamId = getStreamIdentifier(frameHeader);
>> +        int payloadSize = getPayloadSize(streamId, frameHeader);
>> +
>> +        switch (frameType) {
>> +        case FRAME_SETTINGS:
>> +            processFrameSettings(streamId, payloadSize);
>> +            break;
>> +        default:
>> +            // Unknown frame type.
>> +            processFrameUnknown(streamId, frameType, payloadSize);
>> +        }
>>          return false;
>>
> 
> That's really a great example on where you can use the new IO calls I
> proposed: they can replace with a single async call multiple reads (incl
> blocking ones) that are needed to process the frame.
> 
> Comments ?

I'm not sure reading into a 9 byte array is such a good example. I
suspect there will be better ones in the header and data frames. I find
it easier to see how gathering writes would be useful.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to