Class EventReceiverFirehoseFactory.EventReceiverFirehose

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      javax.ws.rs.core.Response addAll​(InputStream in, javax.servlet.http.HttpServletRequest req)
      This method might be called concurrently from multiple threads, if multiple requests arrive to the server at the same time (possibly exact duplicates).
      void close()
      This method is synchronized because it might be called concurrently from multiple threads: from delayedCloseExecutor, and from the thread that creates and uses the Firehose object.
      long getBytesReceived()
      Return the number of bytes received by the firehose.
      int getCapacity()
      Return the capacity of the buffer.
      int getCurrentBufferSize()
      Return the current number of InputRow that are stored in the buffer.
      boolean hasMore()  
      org.apache.druid.data.input.InputRow nextRow()  
      javax.ws.rs.core.Response shutdown​(String shutoffTimeMillis, javax.servlet.http.HttpServletRequest req)
      This method might be called concurrently from multiple threads, if multiple shutdown requests arrive at the same time.
      • Methods inherited from interface org.apache.druid.data.input.Firehose

        nextRowWithRaw
    • Method Detail

      • addAll

        public javax.ws.rs.core.Response addAll​(InputStream in,
                                                @Context
                                                javax.servlet.http.HttpServletRequest req)
                                         throws com.fasterxml.jackson.core.JsonProcessingException
        This method might be called concurrently from multiple threads, if multiple requests arrive to the server at the same time (possibly exact duplicates). Concurrency is controlled in checkProducerSequence(javax.servlet.http.HttpServletRequest, java.lang.String, com.fasterxml.jackson.databind.ObjectMapper), where only requests with "X-Firehose-Producer-Seq" number greater than the max "X-Firehose-Producer-Seq" in previously arrived requests are allowed to proceed. After that check requests don't synchronize with each other and therefore if two large batches are sent with little interval, the events from the batches might be mixed up in buffer (if two addRows(Iterable) are executed concurrently).
        Throws:
        com.fasterxml.jackson.core.JsonProcessingException
      • hasMore

        public boolean hasMore()
        Specified by:
        hasMore in interface org.apache.druid.data.input.Firehose
      • nextRow

        @Nullable
        public org.apache.druid.data.input.InputRow nextRow()
        Specified by:
        nextRow in interface org.apache.druid.data.input.Firehose
      • close

        public void close()
        This method is synchronized because it might be called concurrently from multiple threads: from delayedCloseExecutor, and from the thread that creates and uses the Firehose object.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable
        Specified by:
        close in interface org.apache.druid.data.input.Firehose
      • shutdown

        public javax.ws.rs.core.Response shutdown​(String shutoffTimeMillis,
                                                  @Context
                                                  javax.servlet.http.HttpServletRequest req)
        This method might be called concurrently from multiple threads, if multiple shutdown requests arrive at the same time. No attempts are made to synchronize such requests, or prioritize them a-la "latest shutdown time wins" or "soonest shutdown time wins". delayedCloseExecutor's logic (see createDelayedCloseExecutor()) is indifferent to shutdown times jumping in arbitrary directions. But once a shutdown request is made, it can't be cancelled entirely, the shutdown time could only be rescheduled with a new request.