@@ -84,22 +84,23 @@ public void enterPassthroughMode() {
84
84
if (!passthroughMode ) {
85
85
while (!queue .isEmpty ()) {
86
86
Object o = queue .poll ();
87
-
88
- if (o == NULL_SENTINEL ) {
89
- actual .onNext (null );
90
- } else
91
- if (o == COMPLETE_SENTINEL ) {
92
- actual .onCompleted ();
93
- } else
94
- if (o instanceof ErrorSentinel ) {
95
- actual .onError (((ErrorSentinel )o ).t );
96
- } else
97
- if (o != null ) {
98
- @ SuppressWarnings ("unchecked" )
99
- T v = (T )o ;
100
- actual .onNext (v );
101
- } else {
102
- throw new NullPointerException ();
87
+ if (!actual .isUnsubscribed ()) {
88
+ if (o == NULL_SENTINEL ) {
89
+ actual .onNext (null );
90
+ } else
91
+ if (o == COMPLETE_SENTINEL ) {
92
+ actual .onCompleted ();
93
+ } else
94
+ if (o instanceof ErrorSentinel ) {
95
+ actual .onError (((ErrorSentinel )o ).t );
96
+ } else
97
+ if (o != null ) {
98
+ @ SuppressWarnings ("unchecked" )
99
+ T v = (T )o ;
100
+ actual .onNext (v );
101
+ } else {
102
+ throw new NullPointerException ();
103
+ }
103
104
}
104
105
}
105
106
passthroughMode = true ;
@@ -121,6 +122,9 @@ public void onNext(T t) {
121
122
while (!passthroughMode ) {
122
123
gate .wait ();
123
124
}
125
+ if (actual .isUnsubscribed ()) {
126
+ return ;
127
+ }
124
128
} catch (InterruptedException ex ) {
125
129
Thread .currentThread ().interrupt ();
126
130
actual .onError (ex );
@@ -145,6 +149,9 @@ public void onError(Throwable e) {
145
149
while (!passthroughMode ) {
146
150
gate .wait ();
147
151
}
152
+ if (actual .isUnsubscribed ()) {
153
+ return ;
154
+ }
148
155
} catch (InterruptedException ex ) {
149
156
Thread .currentThread ().interrupt ();
150
157
actual .onError (ex );
@@ -169,6 +176,9 @@ public void onCompleted() {
169
176
while (!passthroughMode ) {
170
177
gate .wait ();
171
178
}
179
+ if (actual .isUnsubscribed ()) {
180
+ return ;
181
+ }
172
182
} catch (InterruptedException ex ) {
173
183
Thread .currentThread ().interrupt ();
174
184
actual .onError (ex );
0 commit comments