users@grizzly.java.net

how parse multiple query in ProtocolParser in the same pass ?

From: Survivant 00 <survivant00_at_gmail.com>
Date: Mon, 24 Nov 2008 15:24:47 -0500

I have a problem. I was able to parse incoming requests with incomplete
requests (the incomplete request, will be parse in the next pass). If the
ByteBuffer contains 1 request + 1 incomplete, the next pass will parse the
incomplete request.. no problem there..

but now.. I did a test.. I sent 3 query in the same requests.

like

aaa|BID[EOQ]bbb|BID[EOQ]ccc|BID[EOQ]

my parser return the first query in getMessage(), but because the server
doesn't receive more datas, it doesn't do a next pass and it stuck with 2
query in the BB.


here the flow

DEBUG [24/11/08 14:44:46]
(com.gfbn.quotegw.connection.handler.parser.QuoteQueryProtocolParser) -
isExpectingMoreData
DEBUG [24/11/08 14:44:46]
(com.gfbn.quotegw.connection.handler.parser.QuoteQueryProtocolParser) -
startBuffer
DEBUG [24/11/08 14:44:46]
(com.gfbn.quotegw.connection.handler.parser.QuoteQueryProtocolParser) -
hasNextMessage
DEBUG [24/11/08 14:44:46]
(com.gfbn.quotegw.connection.handler.parser.QuoteQueryProtocolParser) -
hasNextMessage:
quote|99|bce;can;;t|SYMBOL,PRICE_LAST,PRICE_LAST_DATE[eoq]quote|99|nt;can;;t|SYMBOL,PRICE_LAST,PRICE_LAST_DATE[eoq]quote|99|abx;can;;t|SYMBOL,PRICE_LAST,PRICE_LAST_DATE[eoq]quote|99|aaa;can;;t|SYMBOL,PRICE_LAST,PRICE_LAST_DATE[eoq]quote|99|cdcd;can;;t|SYMBOL,PRICE_LAST,PRICE_LAST_DATE[eoq]
DEBUG [24/11/08 14:44:46]
(com.gfbn.quotegw.connection.handler.parser.QuoteQueryProtocolParser) -
msg=aaa|BID[EOQ]bbb|BID[EOQ]ccc|BID[EOQ]
DEBUG [24/11/08 14:44:46]
(com.gfbn.quotegw.connection.handler.parser.QuoteQueryProtocolParser) -
getNextMessage
DEBUG [24/11/08 14:44:46]
(com.gfbn.quotegw.connection.handler.filter.QuoteQueryManagerFilter) - Query
= aaa|BID
DEBUG [24/11/08 14:44:46]
(com.gfbn.quotegw.connection.handler.parser.QuoteQueryProtocolParser) -
hasMoreBytesToParse
DEBUG [24/11/08 14:44:46]
(com.gfbn.quotegw.connection.handler.parser.QuoteQueryProtocolParser) -
isExpectingMoreData
DEBUG [24/11/08 14:44:46]
(com.gfbn.quotegw.connection.handler.parser.QuoteQueryProtocolParser) -
releaseBuffer
DEBUG [24/11/08 14:44:46]
(com.gfbn.quotegw.connection.handler.parser.QuoteQueryProtocolParser) -
isExpectingMoreData
DEBUG [24/11/08 14:44:46]
(com.gfbn.quotegw.connection.handler.parser.QuoteQueryProtocolParser) -
startBuffer
DEBUG [24/11/08 14:44:46]
(com.gfbn.quotegw.connection.handler.parser.QuoteQueryProtocolParser) -
hasMoreBytesToParse
DEBUG [24/11/08 14:44:46]
(com.gfbn.quotegw.connection.handler.parser.QuoteQueryProtocolParser) -
isExpectingMoreData
DEBUG [24/11/08 14:44:46]
(com.gfbn.quotegw.connection.handler.parser.QuoteQueryProtocolParser) -
releaseBuffer
DEBUG [24/11/08 14:44:51]
(com.gfbn.quotegw.connection.handler.parser.QuoteQueryProtocolParser) -
isExpectingMoreData
DEBUG [24/11/08 14:44:51]
(com.gfbn.quotegw.connection.handler.parser.QuoteQueryProtocolParser) -
startBuffer
DEBUG [24/11/08 14:44:51]
(com.gfbn.quotegw.connection.handler.parser.QuoteQueryProtocolParser) -
hasMoreBytesToParse
DEBUG [24/11/08 14:44:51]
(com.gfbn.quotegw.connection.handler.parser.QuoteQueryProtocolParser) -
releaseBuffer


I didn't detect that in my demo with Grizzly. You can browse the source
code of the parser there
https://grizzly.dev.java.net/source/browse/grizzly/trunk/samples/framework/nio-migration-guide/demo3/src/main/java/com/sun/grizzly/samples/migration/connection/handler/parser/QuoteQueryProtocolParser.java?rev=1836&view=markup