On Sat, Nov 15, 2008 at 6:52 AM, Boubennec Aurelien <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I am new at Mina.
>
> On both server and client side, there is a loop running at a certain 
> frequency.
>
> I just wonder which way is the best to read received messages on both sides 
> to get a pretty low latency.
>
>
> What I plan to do is to add the messages into a SynchronizedQueue .
> I would read the messages by adding a "readQueue()" method in the loops.
> I would also set a maximum amount of time for "readQueue()" for polling so 
> the loop-frequency isn't disturbed.
>
> Is it a good idea or anyone has a better solution ? (I guess my solution is 
> pretty naive though)
> Thanks a lot in advance for your help.

How about sleeping on the Queue, whenever a message is inserted,
notify the thread(s). They shall eventually try to read from the
Queue. If they find anything to consume, they keep on consuming till
messages are there, and then they sleep on Queue waiting for more
data.

>
> orel
-- 
thanks
ashish

Blog: http://www.ashishpaliwal.com/blog

My Photo Galleries: http://www.pbase.com/ashishpaliwal

Reply via email to