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 ? Rémy