Polishing

This commit is contained in:
Sebastien Deleuze
2015-10-07 12:13:35 +02:00
parent ec1189b0b5
commit 906dead596

View File

@@ -27,7 +27,6 @@ import reactor.core.error.Exceptions;
import reactor.core.error.SpecificationExceptions; import reactor.core.error.SpecificationExceptions;
import reactor.core.support.BackpressureUtils; import reactor.core.support.BackpressureUtils;
import reactor.rx.Stream; import reactor.rx.Stream;
import reactor.rx.action.Action;
import reactor.rx.subscription.ReactiveSubscription; import reactor.rx.subscription.ReactiveSubscription;
import org.springframework.util.Assert; import org.springframework.util.Assert;
@@ -115,12 +114,14 @@ public class CompletableFutureUtils {
public void request(long elements) { public void request(long elements) {
try{ try{
BackpressureUtils.checkRequest(elements); BackpressureUtils.checkRequest(elements);
}catch(SpecificationExceptions.Spec309_NullOrNegativeRequest iae){ }
catch (SpecificationExceptions.Spec309_NullOrNegativeRequest iae) {
subscriber.onError(iae); subscriber.onError(iae);
return; return;
} }
if (isComplete()) return; if (isComplete()) {
return;
}
try { try {
future.whenComplete((result, error) -> { future.whenComplete((result, error) -> {
if (error != null) { if (error != null) {
@@ -130,17 +131,17 @@ public class CompletableFutureUtils {
onComplete(); onComplete();
} }
}); });
}
} catch (Throwable e) { catch (Throwable e) {
onError(e); onError(e);
} }
} }
}); });
} catch (Throwable throwable) { }
catch (Throwable throwable) {
Exceptions.publisher(throwable); Exceptions.publisher(throwable);
} }
} }
} }
} }