@@ -1366,6 +1366,13 @@ has [multiple failure paths](#future-method-failure-paths): either the future ma
1366
1366
exceptionally, or the method itself may throw an exception (typically from the blocking operation),
1367
1367
which is illustrated by ` getSalary() throws ConnectionException ` in the above examples.
1368
1368
1369
+ This advice also applies when a method returns any object representing an asynchronous execution
1370
+ other than ` Future ` , such as [ ` Flow.Publisher ` ] (
1371
+ https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/concurrent/Flow.Publisher.html
1372
+ ), [ ` org.reactivestreams.Publisher ` ] (
1373
+ https://www.reactive-streams.org/reactive-streams-1.0.3-javadoc/org/reactivestreams/Publisher.html ),
1374
+ or RxJava's [ ` Observable ` ] ( http://reactivex.io/RxJava/javadoc/io/reactivex/Observable.html ) .
1375
+
1369
1376
<a name =" future-method-failure-paths " ></a >
1370
1377
[ #] ( #future-method-failure-paths ) Ft.3. If a method returns a ` Future ` and some logic in the
1371
1378
beginning of it may lead to an * expected failure* (i. e. not a result of a programming bug), ** was
@@ -1399,6 +1406,10 @@ Future<Response> makeQuery(String query) {
1399
1406
The point of this refactoring is unification of failure paths, so that the users of the API don't
1400
1407
have to deal with multiple different ways of handling errors from the method.
1401
1408
1409
+ Similarly to [ the previous item] ( #future-method-no-blocking ) , this consideration also applies when
1410
+ a method returns any object representing an asynchronous execution other than ` Future ` , such as a
1411
+ ` Publisher ` .
1412
+
1402
1413
### Thread interruption and ` Future ` cancellation
1403
1414
1404
1415
<a name =" restore-interruption " ></a >
0 commit comments