File tree 1 file changed +3
-14
lines changed
src/main/java/ch/petikoch/examples/mvvm_rxjava/utils
1 file changed +3
-14
lines changed Original file line number Diff line number Diff line change @@ -66,20 +66,9 @@ public static Single<FinishedIndicator> executeAsync(Runnable runnable) {
66
66
public static <T > Single <T > executeAsync (Callable <T > callable ) {
67
67
AsyncSubject <T > resultSubject = AsyncSubject .create ();
68
68
69
- final Subscription asyncOp = Observable .<T >create (singleSubscriber -> {
70
- try {
71
- T result = callable .call ();
72
- if (!singleSubscriber .isUnsubscribed ()) {
73
- singleSubscriber .onNext (result );
74
- }
75
- } catch (Exception e ) {
76
- if (!singleSubscriber .isUnsubscribed ()) {
77
- singleSubscriber .onError (e );
78
- }
79
- }
80
- }).subscribeOn (Schedulers .io ())
81
- .first ()
82
- .lift (preserveFullStackTrace ())
69
+ final Subscription asyncOp = Observable .fromCallable (callable )
70
+ .subscribeOn (Schedulers .io ())
71
+ .lift (preserveFullStackTrace ())
83
72
.subscribe (
84
73
t -> {
85
74
resultSubject .onNext (t );
You can’t perform that action at this time.
0 commit comments