need something similiar with java's LinkedBlockingQueue
.
method of interest: messageQueue.poll(120000, TimeUnit.MILLISECONDS);
meaning ..try to get item..and if in X unit of time you still have no item..return null
that + i must be FIFO
after some googling (but havent yet tested): i found ConcurrentQueue (has FIFO behaviour), BlockingCollection (FiFO OR no FIFO??)
BlockingCollection
can be used with any number of different types of collections. If you don't manually pass in a specific type of concurrent collection it will uses a ConcurrentQueue
, meaning it will do exactly what you want. You can uses a concurrent stack type, or a concurrent priority queue if you want, which is why it uses a general name such as Blocking Collection, and not BlockingConcurrentQueue.
All of this is listed on the MSDN page for BlockingCollection
if you don't want to take my word for it.