Sunday, June 11, 2017

Usage of file handles/file streams in GWT source code

Reading and writing of files should only be done using try-with-resources. This might not be an issue on Linux, but it is a serious issue on Windows where I repeatedly get conflicts with GWT DevMode server not releasing file handles, ie. resulting in situations where it cannot even read its own cache files.

One example: Output.openSourceFile returns a file input stream. SourceHandler.makeSourcePage then does

return Responses.newBinaryStreamResponse("text/plain", pageBytes);

where it eventually might get closed if no error happens... and on top of that the stream is kept open as long as the client wishes to stall reading the response data.

I suggest setting up a GWT-internal standard for handling file resources. My recommendation would be to use try-with-resources and processing a file copy that is stored fully in RAM.


--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment