Hello Ken,
attached is updated version of ProtocolParser.
In that version we don't copy bytes from buffer to buffer, except the
case if packet does not fit to the ByteBuffer (packet size >
ByteBuffer.capacity()). Specifically for your usecase, IMHO, it never
happen, but I added that to make implementation more common.
Just wanted to ask you, if it will work for you... is it possible to
use your sample to write the blog about ProtocolParser optimization?
Thank you.
WBR,
Alexey.
On May 14, 2008, at 16:55 , Ken--_at_newsgroupstats.hk wrote:
>
> Thanks.
>
> Attached pls find my netbeans project.
>
> http://www.nabble.com/file/p17233065/GrizzlyServer.rar
> GrizzlyServer.rar
>
>
>
>
> Oleksiy Stashok wrote:
>>
>> Hello Ken,
>>
>> I have some ideas how we can improve your code, especially avoid
>> redundant array copying.
>> But can you pls. provide your complete server code, so it will be
>> easier for me to tune the ProtocolFilter and propose you some
>> changes.
>>
>> Thanks.
>>
>> WBR,
>> Alexey.
>>
>> On May 14, 2008, at 8:50 , Ken--_at_newsgroupstats.hk wrote:
>>
>>>
>>> I dig it out myself, the default value of partial should not be
>>> 'true'.
>>> Please kindly comment my code.
>>>
>>>
>>> Ken--_at_newsgroupstats.hk wrote:
>>>>
>>>> Well, I gone another problem. I tried Hyper Terminal to connect
>>>> to my
>>>> server. Send some bytes by it's 'Send Text File' function then
>>>> disconnect.
>>>> The cpu loading of my server will then up to 100%. After
>>>> investigation, I
>>>> found that the selectorThread will keep calling
>>>> MyProtocolParser.isExpectingMoreData() and it always return true.
>>>> So, my
>>>> problem is:
>>>>
>>>> 1. how to implement isExpectingMoreData() so that it will return
>>>> false
>>>> whenever client disconnect?
>>>> 2. why selectorThread keep calling isExpectingMoreData()?
>>>>
>>>> Regards,
>>>> Ken
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/ProtocolParser-implementation-II-tp17152654p17224482.html
>>> Sent from the Grizzly - Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/ProtocolParser-implementation-II-tp17152654p17233065.html
> Sent from the Grizzly - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>