Is there a way to block socket and lock in java?

Ideally, I would like to add my blocking queue to the selector so that I can block reading from the socket or until an element appears in the blocking queue.

Is there a higher level selector function that works with disparate types?

I could exit the crappy exit and disable 2 threads and each one individually, but it would be easier to have one function that could block both types of objects.

Is there a way to capture a monitor for every object that is locked and use a selector object to lock on both?

+4
source share
1 answer

, . , , , , , , .

+2

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


All Articles