public abstract class BlockingQueueStreamSource<T> extends Object implements StreamSource<T>
Child classes should implement StreamSource.open()
to connect to a datasource. The child .open implementation will
typically start a new thread that feeds rows of data to the acceptRows(List)
method. Any resource cleanup
should be included in a .close() implementation, along with a call to super.close() to complete the blocking
iterable.
Modifier and Type | Field and Description |
---|---|
protected BaseStreamStep |
streamStep |
Modifier | Constructor and Description |
---|---|
protected |
BlockingQueueStreamSource(BaseStreamStep streamStep) |
Modifier and Type | Method and Description |
---|---|
protected void |
acceptRows(List<T> rows)
Accept rows, blocking if currently paused or if there are no permits
|
void |
close()
Signals this stream is no longer in use and can clean up
resources.
|
void |
error(Throwable throwable)
Child implementations of this class can call .error() when an unexpected event occurs while passing rows to the
acceptRows() method.
|
io.reactivex.Flowable<T> |
flowable()
Returns the rows of data as an iterable.
|
void |
pause()
Marks the source paused (if not already) and acquires the permit, which will cause acceptRows to block.
|
protected Object |
readBytes(byte[] bytes) |
void |
resume()
Resumes accepting input if paused, otherwise noop.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
open
protected final BaseStreamStep streamStep
protected BlockingQueueStreamSource(BaseStreamStep streamStep)
public io.reactivex.Flowable<T> flowable()
StreamSource
flowable
in interface StreamSource<T>
public void close()
StreamSource
close
in interface StreamSource<T>
public void pause()
pause
in interface StreamSource<T>
public void resume()
StreamSource
resume
in interface StreamSource<T>
protected void acceptRows(List<T> rows)
Implementations should implement the open() function to pass external row events to the acceptRows method.
public void error(Throwable throwable)
protected Object readBytes(byte[] bytes)
Copyright © 2020 Hitachi Vantara. All rights reserved.