JAX-RS ChunkedOutput and ChunkedInput Example

You may also like...

Leave a Reply

1 Comment threads
0 Thread replies
Most reacted comment
Hottest comment thread
1 Comment authors
Robert Whent Recent comment authors
newest oldest
Notify of
Robert Whent
Robert Whent

I’ve had issues with ChunkedOutput not being fully thread safe even though flushQueue() has some synchronization. What can happen is that the thread returning the ChunkedOutput class to the server can attempt to read and flush the queue at the same time as the thread performing the work to write the chunks, writes and flushes the queue. The result is that one of the threads assumes it should close the stream an subsequent writes fail with an EOF exception. In order to overcome this issue I needed to derive a class and override the offending functions. import java.lang.reflect.Type; import javax.ws.rs.container.ConnectionCallback;… Read more »