• Post Reply Bookmark Topic Watch Topic
  • New Topic

Queue Problem?  RSS feed

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hallo,

I am new to Java, I need some information regarding String Queues in Java.

I wanted a queue, which should wait on new element. I do not want poll the loop for new data. I should need non poll type queue, which stay for new event. When ever new element arriaves it should come out from that statement and it should give me the element.

Please let me know, if somebody know about queues in Java.

thanks
Regards,
Sashi
 
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would be a great learning exercise in threads to build such a queue from scratch. If you would like to learn a lot about threading, shift over to the Threads etc. forum and tell us how you think it might work.

If you'd rather "buy" than "build", Java5 introduced BlockingQueue which does just what you want. For older JDKs, look into the Jakarta Commons Thread Pool.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!