38
38
*/
39
39
@ Experimental
40
40
public class Completable {
41
- /** The error handler instance. */
42
- static final RxJavaErrorHandler ERROR_HANDLER = RxJavaPlugins .getInstance ().getErrorHandler ();
43
-
44
- /** The completable hook. */
45
- static RxJavaCompletableExecutionHook HOOK = RxJavaPlugins .getInstance ().getCompletableExecutionHook ();
46
-
47
41
/**
48
42
* Callback used for building deferred computations that takes a CompletableSubscriber.
49
43
*/
@@ -146,7 +140,7 @@ public void onError(Throwable e) {
146
140
set .unsubscribe ();
147
141
s .onError (e );
148
142
} else {
149
- ERROR_HANDLER . handleError (e );
143
+ RxJavaHooks . onError (e );
150
144
}
151
145
}
152
146
@@ -167,7 +161,7 @@ public void onSubscribe(Subscription d) {
167
161
set .unsubscribe ();
168
162
s .onError (npe );
169
163
} else {
170
- ERROR_HANDLER . handleError (npe );
164
+ RxJavaHooks . onError (npe );
171
165
}
172
166
return ;
173
167
}
@@ -215,7 +209,7 @@ public void onError(Throwable e) {
215
209
set .unsubscribe ();
216
210
s .onError (e );
217
211
} else {
218
- ERROR_HANDLER . handleError (e );
212
+ RxJavaHooks . onError (e );
219
213
}
220
214
}
221
215
@@ -256,7 +250,7 @@ public void onSubscribe(Subscription d) {
256
250
set .unsubscribe ();
257
251
s .onError (e );
258
252
} else {
259
- ERROR_HANDLER . handleError (e );
253
+ RxJavaHooks . onError (e );
260
254
}
261
255
return ;
262
256
}
@@ -283,7 +277,7 @@ public void onSubscribe(Subscription d) {
283
277
set .unsubscribe ();
284
278
s .onError (e );
285
279
} else {
286
- ERROR_HANDLER . handleError (e );
280
+ RxJavaHooks . onError (e );
287
281
}
288
282
return ;
289
283
}
@@ -294,7 +288,7 @@ public void onSubscribe(Subscription d) {
294
288
set .unsubscribe ();
295
289
s .onError (npe );
296
290
} else {
297
- ERROR_HANDLER . handleError (npe );
291
+ RxJavaHooks . onError (npe );
298
292
}
299
293
return ;
300
294
}
@@ -386,7 +380,7 @@ public static Completable create(CompletableOnSubscribe onSubscribe) {
386
380
} catch (NullPointerException ex ) {
387
381
throw ex ;
388
382
} catch (Throwable ex ) {
389
- ERROR_HANDLER . handleError (ex );
383
+ RxJavaHooks . onError (ex );
390
384
throw toNpe (ex );
391
385
}
392
386
}
@@ -912,7 +906,7 @@ void dispose() {
912
906
try {
913
907
disposer .call (resource );
914
908
} catch (Throwable ex ) {
915
- ERROR_HANDLER . handleError (ex );
909
+ RxJavaHooks . onError (ex );
916
910
}
917
911
}
918
912
}
@@ -980,7 +974,7 @@ public void call() {
980
974
* not null (not verified)
981
975
*/
982
976
protected Completable (CompletableOnSubscribe onSubscribe ) {
983
- this .onSubscribe = HOOK .onCreate (onSubscribe );
977
+ this .onSubscribe = RxJavaHooks .onCreate (onSubscribe );
984
978
}
985
979
986
980
/**
@@ -1338,7 +1332,7 @@ public void onCompleted() {
1338
1332
try {
1339
1333
onAfterComplete .call ();
1340
1334
} catch (Throwable e ) {
1341
- ERROR_HANDLER . handleError (e );
1335
+ RxJavaHooks . onError (e );
1342
1336
}
1343
1337
}
1344
1338
@@ -1371,7 +1365,7 @@ public void call() {
1371
1365
try {
1372
1366
onUnsubscribe .call ();
1373
1367
} catch (Throwable e ) {
1374
- ERROR_HANDLER . handleError (e );
1368
+ RxJavaHooks . onError (e );
1375
1369
}
1376
1370
d .unsubscribe ();
1377
1371
}
@@ -1552,7 +1546,7 @@ public final Completable lift(final CompletableOperator onLift) {
1552
1546
@ Override
1553
1547
public void call (CompletableSubscriber s ) {
1554
1548
try {
1555
- CompletableOperator onLiftDecorated = HOOK . onLift (onLift );
1549
+ CompletableOperator onLiftDecorated = RxJavaHooks . onCompletableLift (onLift );
1556
1550
CompletableSubscriber sw = onLiftDecorated .call (s );
1557
1551
1558
1552
unsafeSubscribe (sw );
@@ -1879,7 +1873,7 @@ public void onCompleted() {
1879
1873
1880
1874
@ Override
1881
1875
public void onError (Throwable e ) {
1882
- ERROR_HANDLER . handleError (e );
1876
+ RxJavaHooks . onError (e );
1883
1877
mad .unsubscribe ();
1884
1878
deliverUncaughtException (e );
1885
1879
}
@@ -1896,7 +1890,7 @@ public void onSubscribe(Subscription d) {
1896
1890
* Subscribes to this Completable and calls the given Action0 when this Completable
1897
1891
* completes normally.
1898
1892
* <p>
1899
- * If this Completable emits an error, it is sent to ERROR_HANDLER.handleError and gets swallowed.
1893
+ * If this Completable emits an error, it is sent to RxJavaHooks.onError and gets swallowed.
1900
1894
* @param onComplete the runnable called when this Completable completes normally
1901
1895
* @return the Subscription that allows cancelling the subscription
1902
1896
*/
@@ -1913,7 +1907,7 @@ public void onCompleted() {
1913
1907
try {
1914
1908
onComplete .call ();
1915
1909
} catch (Throwable e ) {
1916
- ERROR_HANDLER . handleError (e );
1910
+ RxJavaHooks . onError (e );
1917
1911
deliverUncaughtException (e );
1918
1912
} finally {
1919
1913
mad .unsubscribe ();
@@ -1923,7 +1917,7 @@ public void onCompleted() {
1923
1917
1924
1918
@ Override
1925
1919
public void onError (Throwable e ) {
1926
- ERROR_HANDLER . handleError (e );
1920
+ RxJavaHooks . onError (e );
1927
1921
mad .unsubscribe ();
1928
1922
deliverUncaughtException (e );
1929
1923
}
@@ -1972,7 +1966,7 @@ public void onError(Throwable e) {
1972
1966
done = true ;
1973
1967
callOnError (e );
1974
1968
} else {
1975
- ERROR_HANDLER . handleError (e );
1969
+ RxJavaHooks . onError (e );
1976
1970
deliverUncaughtException (e );
1977
1971
}
1978
1972
}
@@ -1982,7 +1976,7 @@ void callOnError(Throwable e) {
1982
1976
onError .call (e );
1983
1977
} catch (Throwable ex ) {
1984
1978
e = new CompositeException (Arrays .asList (e , ex ));
1985
- ERROR_HANDLER . handleError (e );
1979
+ RxJavaHooks . onError (e );
1986
1980
deliverUncaughtException (e );
1987
1981
} finally {
1988
1982
mad .unsubscribe ();
@@ -2011,15 +2005,15 @@ private static void deliverUncaughtException(Throwable e) {
2011
2005
public final void unsafeSubscribe (CompletableSubscriber s ) {
2012
2006
requireNonNull (s );
2013
2007
try {
2014
- CompletableOnSubscribe onSubscribeDecorated = HOOK . onSubscribeStart (this , this .onSubscribe );
2008
+ CompletableOnSubscribe onSubscribeDecorated = RxJavaHooks . onCompletableStart (this , this .onSubscribe );
2015
2009
2016
2010
onSubscribeDecorated .call (s );
2017
2011
} catch (NullPointerException ex ) {
2018
2012
throw ex ;
2019
2013
} catch (Throwable ex ) {
2020
2014
Exceptions .throwIfFatal (ex );
2021
- ex = HOOK . onSubscribeError (ex );
2022
- ERROR_HANDLER . handleError (ex );
2015
+ ex = RxJavaHooks . onCompletableError (ex );
2016
+ RxJavaHooks . onError (ex );
2023
2017
throw toNpe (ex );
2024
2018
}
2025
2019
}
@@ -2077,13 +2071,13 @@ public void onSubscribe(Subscription d) {
2077
2071
s .add (d );
2078
2072
}
2079
2073
});
2080
- RxJavaPlugins . getInstance (). getObservableExecutionHook (). onSubscribeReturn (s );
2074
+ RxJavaHooks . onObservableReturn (s );
2081
2075
} catch (NullPointerException ex ) {
2082
2076
throw ex ;
2083
2077
} catch (Throwable ex ) {
2084
2078
Exceptions .throwIfFatal (ex );
2085
- ex = HOOK . onSubscribeError (ex );
2086
- ERROR_HANDLER . handleError (ex );
2079
+ ex = RxJavaHooks . onObservableError (ex );
2080
+ RxJavaHooks . onError (ex );
2087
2081
throw toNpe (ex );
2088
2082
}
2089
2083
}
0 commit comments