This repository was archived by the owner on May 28, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
core-server/src/main/java/org/glassfish/jersey/server Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 4747import java .util .concurrent .BlockingDeque ;
4848import java .util .concurrent .Callable ;
4949import java .util .concurrent .LinkedBlockingDeque ;
50+ import java .util .concurrent .atomic .AtomicBoolean ;
5051
5152import javax .ws .rs .container .ConnectionCallback ;
5253import javax .ws .rs .core .GenericType ;
@@ -74,11 +75,11 @@ public class ChunkedOutput<T> extends GenericType<T> implements Closeable {
7475
7576 private final BlockingDeque <T > queue = new LinkedBlockingDeque <>();
7677 private final byte [] chunkDelimiter ;
78+ private final AtomicBoolean resumed = new AtomicBoolean (false );
7779
7880 private boolean flushing = false ;
7981
8082 private volatile boolean closed = false ;
81- private volatile boolean resumed = false ;
8283
8384 private volatile AsyncContext asyncContext ;
8485
@@ -204,8 +205,7 @@ public void write(final T chunk) throws IOException {
204205 }
205206
206207 protected void flushQueue () throws IOException {
207- if (!resumed && asyncContext != null ) {
208- resumed = true ;
208+ if (resumed .compareAndSet (false , true ) && asyncContext != null ) {
209209 asyncContext .resume (this );
210210 }
211211
You can’t perform that action at this time.
0 commit comments