Browse Source

minor fix and update to work on latest 2.1.0.BUILD-SNAPSHOT to use core check in CFUtils

pull/1111/head
Stephane Maldini 9 years ago
parent
commit
ec1189b0b5
  1. 12
      spring-web-reactive/src/main/java/org/springframework/reactive/util/CompletableFutureUtils.java

12
spring-web-reactive/src/main/java/org/springframework/reactive/util/CompletableFutureUtils.java

@ -24,6 +24,8 @@ import org.reactivestreams.Publisher;
import org.reactivestreams.Subscriber; import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription; import org.reactivestreams.Subscription;
import reactor.core.error.Exceptions; import reactor.core.error.Exceptions;
import reactor.core.error.SpecificationExceptions;
import reactor.core.support.BackpressureUtils;
import reactor.rx.Stream; import reactor.rx.Stream;
import reactor.rx.action.Action; import reactor.rx.action.Action;
import reactor.rx.subscription.ReactiveSubscription; import reactor.rx.subscription.ReactiveSubscription;
@ -111,15 +113,19 @@ public class CompletableFutureUtils {
@Override @Override
public void request(long elements) { public void request(long elements) {
Action.checkRequest(elements); try{
BackpressureUtils.checkRequest(elements);
}catch(SpecificationExceptions.Spec309_NullOrNegativeRequest iae){
subscriber.onError(iae);
return;
}
if (isComplete()) return; if (isComplete()) return;
try { try {
future.whenComplete((result, error) -> { future.whenComplete((result, error) -> {
if (error != null) { if (error != null) {
onError(error); onError(error);
} } else {
else {
subscriber.onNext(result); subscriber.onNext(result);
onComplete(); onComplete();
} }

Loading…
Cancel
Save