Adam Smolnik wrote:Could you show main fragments of your implementation?
This is the class that is doing the piping
And the following is written by others to read from my class
[edit]
Ireneusz Kordal wrote:The writer can simply store a reference to the reader thread and check it's status with 'isAlive'.
I am not sure how I would be able to do this as when I do a write to the output it can lock the thread until the buffer is freed up by reading the input.
Ireneusz Kordal wrote:Or you can do it in a more sophisticated way using observer design pattern (look at Observer/Observable in the java API).
Reader can wrap an Observable object, and Writer can register to the reader as Observer.
When Reader finishes it fires a message to all Observers.
I am not sure how I would be able to do this as I would depend on others to add the observer, plus it would remove the simplicity of just having them read from the input stream.