How to block answers on Play without running out of memory

I iterate over a large dataset with regular calls play.mvc.Results.Chunks.Out.write(...)from onReady.

Since the records are faster than the data is sent to the client, after a while I will run out of memory ... So what is the right way to do this?

+4
source share
1 answer

Unfortunately, this is currently a limitation for the Play Java API in Play. There is no way in the Java API to get pressure from the client, so it is easy to suppress. This will be fixed in Play 3 when we provide the best threading API for Java clients, possibly based on Akka threads .

If you really need to solve this problem, you can write a small program in Scala based on playlists and then wrap it so that you can access it from your Java program.

+3
source

All Articles