directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trustin Lee <>
Subject Re: [Mina] Best to have prioritary messages
Date Wed, 12 Oct 2005 16:44:09 GMT
2005/10/11, <>:
> 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? :)

what we call human nature is actually human habit

View raw message