leventov commented on a change in pull request #7038: Fix and document
concurrency of EventReceiverFirehose and TimedShutoffFirehose; Refine
concurrency specification of Firehose
URL: https://github.com/apache/incubator-druid/pull/7038#discussion_r259095613
##########
File path: core/src/main/java/org/apache/druid/data/input/Firehose.java
##########
@@ -23,28 +23,33 @@
import javax.annotation.Nullable;
import java.io.Closeable;
+import java.io.IOException;
/**
* This is an interface that holds onto the stream of incoming data. Realtime
data ingestion is built around this
- * abstraction. In order to add a new type of source for realtime data
ingestion, all you need to do is implement
- * one of these and register it with the Main.
+ * abstraction.
*
* This object acts a lot like an Iterator, but it doesn't extend the Iterator
interface because it extends
- * Closeable and it is very important that the close() method doesn't get
forgotten, which is easy to do if this
- * gets passed around as an Iterator.
- * <p>
- * The implementation of this interface only needs to be minimally
thread-safe. The three methods ##hasMore(),
- * ##nextRow() and ##commit() are all called from the same thread.
##commit(), however, returns a callback
- * which will be called on another thread, so the operations inside of that
callback must be thread-safe.
+ * Closeable and it is very important that the {@link #close()} method doesn't
get forgotten, which is easy to do if
+ * this gets passed around as an Iterator. Note that {@link #close()} doesn't
cut the stream of rows for Firehose users
+ * immediately, but rather stops the supply of new rows into internal buffers.
{@link #hasMore()} and {@link #nextRow()}
+ * are expected to operate for some time after (or concurrently with) {@link
#close()} until the buffered events (if
+ * any) run out.
+ *
+ * Concurrency:
+ * The three methods {@link #hasMore()}, {@link #nextRow()} and {@link
#commit()} are all called from the same thread.
+ * {@link #commit()}, however, returns a callback which will be called on
another thread. {@link #close()} might be
+ * called concurrenly from a thread different from the thread calling {@link
#hasMore()}, {@link #nextRow()} and {@link
Review comment:
Thanks, fixed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]