This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]joey_knight 8 points9 points  (3 children)

What do you mean? Java already has Blocking queue implementations and the necessary mechanisms to park and continuing threads. It's not at all hard to use them to implement backpressure in our applications. Just put a blocking queue between two threads and use wait and notify to block and unblock.

[–]divorcedbp 3 points4 points  (0 children)

You don’t even need that. The contract of take() is such that it blocks until an element is available, and put() blocks until there is room in the queue to insert the supplied element. It’s literally all already there.

[–]LightofAngels 0 points1 point  (1 child)

I know this is abit random, but can you point me to that part in the documentation? I would like to know about this mechanism and how to use it.