Is Java the equivalent of a pump pattern to handle slow clients?

At the moment, we have an architecture where the server transfers data to the client. We find cases where the client cannot process the data fast enough, buffer overflows and client failures. Node.js has a pumping circuit whereby a stream can be suspended if the data is not completely discharged and then resumed after the stream is depleted. How to make an equivalent pause / resume cycle in Java?

+4
source share
1 answer

This is not exactly the same, but to me it sounds like a variation on the theme of the producer / consumer. Place a blocking queue between them. If the consumer cannot keep up, the blocking queue continues to receive messages from the manufacturer and accumulate them until the consumer is ready.

Or maybe you mean this .

+1
source

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


All Articles