BAEL-679 second draft

This commit is contained in:
sp619r 2017-04-03 21:02:58 -07:00
parent a6ac1198e3
commit 975ee3bc85
1 changed files with 2 additions and 4 deletions

View File

@ -43,11 +43,9 @@ public class BaeldungBatchSubscriberImpl<T> implements Subscriber<String> {
// if buffer is full, process the items. // if buffer is full, process the items.
if (buffer.size() >= BUFFER_SIZE) { if (buffer.size() >= BUFFER_SIZE) {
processBuffer(); processBuffer();
subscription.request(BUFFER_SIZE);
} else if(buffer.size() == 0) {
// If buffer empty, request more items.
subscription.request(BUFFER_SIZE);
} }
//request more items.
subscription.request(1);
} }
private void processBuffer() { private void processBuffer() {