I have a request handler that instantiates a PipedReader
and a PipedWriter
. I write messages into the pipe, they're handled in another thread, which puts the result back into the pipe. Everything works fine, except when the processing takes enough time, the pipe just up and dies with Stream closed
. Everything works OK if I instantiate the reader and the writer outside the request handler, but that's not going to work because I need to be able to close the reader and the writer. Does anyone have any ideas what might cause something like this? It's driving me crazy.
Actually, looks like I'm getting Stream closed
even when I instantiate them outside the handler... sigh.
Looks like using wrapping the pipe with BufferedWriter
and BufferedReader
solves the issue.
Or not.