[PJUG Javamail] super fast reentrant queues?

pierce403 at gmail.com pierce403 at gmail.com
Tue Sep 22 14:12:32 EDT 2009


I have a bit of an academic question for the group.  What would you say is the most efficient method of implementing shared/reentrant queues?  I am in the midst of optimizing some packet sniffing code I wrote a while back.  The model looks like this:

I have one reader thread, and multiple ~(3-15) builder threads.  The reader thread first pulls a packet off of the network card, and puts it in the queue of the first builder.  That first builder takes a packet off its queue, does some analysis on it, then based on that analysis it might send that packet to one or more of the other builders.  In this model, any given queue has at least one thread writing to it, and a single thread reading from it.

Pretty basic producer/consumer type threading issue, and I could easily (and did!) write a queuing system that "works", but since I am a completely self taught java programmer, I realize I might have overlooked a more simple/efficient/safe way of doing things.  Any advice?  Thanks.

   - DEAN
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.pjug.org/pipermail/javamail/attachments/20090922/935e2e61/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 908 bytes
Desc: OpenPGP digital signature
Url : http://www.pjug.org/pipermail/javamail/attachments/20090922/935e2e61/attachment.bin 


More information about the Javamail mailing list