Reading from multiple BlockingQueues within the same thread

I have three instances of Java LinkedBlockingQueue, and I would like to read them ( takeoperation) using only one stream. The naive approach is to have one thread in the queue.

Is there something like a UNIX system call selectto block queues in Java?

Thank.

+3
source share
1 answer

Well, these BlockingQueues were really meant to serve their own threads.

-, , , Boolean s, offer() , 4 . 4- , , peek() 3, , .

, , , , . .

+2

Source: https://habr.com/ru/post/1755022/


All Articles