Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-2282

Control default FLUSH_PASSED_TO_STREAM behavior of JsonEncoder

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.7.4
    • java
    • Patch

    Description

      The FLUSH_PASSED_TO_STREAM feature of jackson's JSONGenerator controls if flush calls to JsonEncoder are passed to the underlying stream. The default value for this is true causing the underlying stream to be flushed every time encoder.flush is called. Currently, JsonEncoder doesn't provide a way to change this behaviour. In many scenarios, a flush call is made to the encoder with the intention of flushing the buffer to the underlying stream, and not the stream itself, which has a detrimental impact on performance. The patch provided creates a way to specify the default behaviour of underlying JSONGenerator during JsonEncoder's initialization itself. This will be extremely helpful in scenarios such as Hadoop's MR Evenwriter, allowing the caller to set the desired behaviour for optimal performance. 

      Attachments

        1. avrojsonencoder1.patch
          15 kB
          Saurabh
        2. avrojsonencoder1.patch
          15 kB
          Saurabh

        Issue Links

          Activity

            People

              clesaec Christophe Le Saec
              saurabhpant Saurabh
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h