Skip to content

Commit

Permalink
Buffer byte stream instead of dropping
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Burman committed Mar 30, 2018
1 parent 871e94c commit 5b385ec
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import rx.Observable;
import rx.Observer;
import rx.Subscriber;
import rx.exceptions.Exceptions;

/**
* An {@link Observable} interface to Servlet API
Expand Down Expand Up @@ -76,12 +77,12 @@ public static Observable<Void> write(final Observable<byte[]> data, final Servle
return Observable.create(new Observable.OnSubscribe<Void>() {
@Override
public void call(Subscriber<? super Void> subscriber) {
Observable<Void> events = create(out).onBackpressureDrop();
Observable<Void> events = create(out).onBackpressureBuffer();
Observable<Void> writeobs = Observable.zip(data, events, (b, aVoid) -> {
try {
out.write(b);
} catch (IOException ioe) {
ioe.printStackTrace();
Exceptions.propagate(ioe);
}
return null;
});
Expand Down

0 comments on commit 5b385ec

Please sign in to comment.