File tree Expand file tree Collapse file tree 1 file changed +24
-15
lines changed
src/main/groovy/org/grails/plugins/rx/web Expand file tree Collapse file tree 1 file changed +24
-15
lines changed Original file line number Diff line number Diff line change @@ -105,11 +105,13 @@ class RxResultSubscriber extends Subscriber implements AsyncListener {
105
105
106
106
@Override
107
107
void onNext (Object o ) {
108
- if (asyncComplete) {
109
- if ( ! isUnsubscribed() ) {
110
- unsubscribe()
108
+ synchronized (asyncContext) {
109
+ if (asyncComplete) {
110
+ if ( ! isUnsubscribed() ) {
111
+ unsubscribe()
112
+ }
113
+ return
111
114
}
112
- return
113
115
}
114
116
115
117
if (o instanceof RxResult ) {
@@ -252,27 +254,34 @@ class RxResultSubscriber extends Subscriber implements AsyncListener {
252
254
253
255
@Override
254
256
void onComplete (AsyncEvent event ) throws IOException {
255
- asyncComplete = true
256
- if (! isUnsubscribed()) {
257
- unsubscribe()
257
+ synchronized (asyncContext) {
258
+ asyncComplete = true
259
+ if (! isUnsubscribed()) {
260
+ unsubscribe()
261
+ }
258
262
}
259
263
}
260
264
261
265
@Override
262
266
void onTimeout (AsyncEvent event ) throws IOException {
263
- if (! isUnsubscribed()) {
264
- unsubscribe()
265
- onError(event. throwable)
266
- asyncComplete = true
267
+ synchronized (asyncContext) {
268
+
269
+ if (! isUnsubscribed()) {
270
+ unsubscribe()
271
+ onError(event. throwable)
272
+ asyncComplete = true
273
+ }
267
274
}
268
275
}
269
276
270
277
@Override
271
278
void onError (AsyncEvent event ) throws IOException {
272
- if (! isUnsubscribed()) {
273
- unsubscribe()
274
- onError(event. throwable)
275
- asyncComplete = true
279
+ synchronized (asyncContext) {
280
+ if (! isUnsubscribed()) {
281
+ unsubscribe()
282
+ onError(event. throwable)
283
+ asyncComplete = true
284
+ }
276
285
}
277
286
}
278
287
You can’t perform that action at this time.
0 commit comments