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 23:43:29 GMT
2005/10/13, Jean-Fran├žois Daune <>:
> > 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.
> I am sorry, but I don't get it. What do you exactly mean by "have any
> events to fire in them"?

It means that all SessionBuffers in busySessionBuffers contains at least 1
events to fire. The SessionBuffer is added both to readySessionBuffers and
to busySessionBuffers, but it is removed from readySessionBuffer soon by a
worker thread (the leader).

In your case, you can simply retain what I've done with busySessionBuffers.
You can safely modify fetchBuffer.

> 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.
> But that is exactly what fireEvent does. It adds a same SessionBuffer to
> the two sets. I am a bit confused.

They should contain the same stuff at the beginning, but busySessionBuffers
are only used to prevent duplication because the SessionBuffer will get
removed from readySessionBuffers.

what we call human nature is actually human habit

View raw message