2005/10/11, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
I see.
Yes, you're correct. You'll have to maintain the number of the messages of that type so you don't waste the time while iterating the buffer.
busySessionBuffers contains the SessionBuffers which have any events to fire in them. readySessionBuffers contains the SessionBuffers which are waiting for the leader thread to process them. So a SessionBuffer is removed from readySessionBuffers when the leader thread takes it, but not from busySessionBuffers to prevent the same SessionBuffer from being added to readySessionBuffers and busySessionBuffers because it will cause severe synchronization issue.
BTW the names are really confusing. I had to spend some time to explain this to you. I'd better change them to more clear ones. Any suggestions? :)
HTH,
Trustin
-- I don't want to reorder messages received per session.
Instead, when my server 'elects' the next session for processing, I want it to
first promote the sessions having a message X older than (Y-Z) seconds.
I see.
I have checked BaseThreadPool, and if I understand well, I would need
to change
'fetchBuffer' so that it first chooses SessionBuffer containing such message.
Is that correct?
Yes, you're correct. You'll have to maintain the number of the messages of that type so you don't waste the time while iterating the buffer.
I am not sure as the difference between readySessionBuffers and
busySessionBuffers does not appear clearly to me (why is a BufferSession added
to busySessionBuffers in fireEvent?)
busySessionBuffers contains the SessionBuffers which have any events to fire in them. readySessionBuffers contains the SessionBuffers which are waiting for the leader thread to process them. So a SessionBuffer is removed from readySessionBuffers when the leader thread takes it, but not from busySessionBuffers to prevent the same SessionBuffer from being added to readySessionBuffers and busySessionBuffers because it will cause severe synchronization issue.
BTW the names are really confusing. I had to spend some time to explain this to you. I'd better change them to more clear ones. Any suggestions? :)
HTH,
Trustin
what we call human nature is actually human habit
--
http://gleamynode.net/
