public class BufferSubscriber
extends java.lang.Object
implements io.reactivex.FlowableSubscriber<com.epam.ta.reportportal.ws.model.log.SaveLogRQ>, org.reactivestreams.Subscription
SaveLogRQ objects until certain conditions are met,
then emits them as batches to the downstream subscriber.
This class implements a buffering mechanism with two boundary conditions:
batchMaxSize)batchPayloadLimit)When either of these conditions is met, the current buffer is emitted downstream as a list and a new buffer is created. This helps optimize network requests by batching multiple logs together while ensuring the batch size remains within reasonable limits.
The class is thread-safe, using a ReentrantLock to protect access to the buffer during concurrent operations.
| Constructor and Description |
|---|
BufferSubscriber(org.reactivestreams.Subscriber<? super java.util.List<com.epam.ta.reportportal.ws.model.log.SaveLogRQ>> actual,
int batchMaxSize,
long batchPayloadLimit) |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel() |
void |
onComplete() |
void |
onError(java.lang.Throwable t) |
void |
onNext(com.epam.ta.reportportal.ws.model.log.SaveLogRQ t) |
void |
onSubscribe(org.reactivestreams.Subscription s) |
void |
request(long n) |
public BufferSubscriber(org.reactivestreams.Subscriber<? super java.util.List<com.epam.ta.reportportal.ws.model.log.SaveLogRQ>> actual,
int batchMaxSize,
long batchPayloadLimit)
public void onSubscribe(@Nonnull
org.reactivestreams.Subscription s)
onSubscribe in interface io.reactivex.FlowableSubscriber<com.epam.ta.reportportal.ws.model.log.SaveLogRQ>onSubscribe in interface org.reactivestreams.Subscriber<com.epam.ta.reportportal.ws.model.log.SaveLogRQ>public void onNext(com.epam.ta.reportportal.ws.model.log.SaveLogRQ t)
onNext in interface org.reactivestreams.Subscriber<com.epam.ta.reportportal.ws.model.log.SaveLogRQ>public void onError(java.lang.Throwable t)
onError in interface org.reactivestreams.Subscriber<com.epam.ta.reportportal.ws.model.log.SaveLogRQ>public void onComplete()
onComplete in interface org.reactivestreams.Subscriber<com.epam.ta.reportportal.ws.model.log.SaveLogRQ>public void request(long n)
request in interface org.reactivestreams.Subscriptionpublic void cancel()
cancel in interface org.reactivestreams.Subscription