@@ -111,11 +111,11 @@ public Object toLogValue() {
111
111
protected RequestInfo createRequest (final AsyncHttpClient client , final byte [] serializedData ) {
112
112
final byte [] bodyData ;
113
113
if (_enableCompression ) {
114
- try {
115
- final ByteArrayOutputStream bos = new ByteArrayOutputStream ();
116
- final GZIPOutputStream gzipStream = new GZIPOutputStream ( bos );
114
+ try ( ByteArrayOutputStream bos = new ByteArrayOutputStream ();
115
+ GZIPOutputStream gzipStream = new GZIPOutputStream ( bos )) {
116
+
117
117
gzipStream .write (serializedData );
118
- gzipStream .close ();
118
+ gzipStream .flush ();
119
119
bodyData = bos .toByteArray ();
120
120
} catch (final IOException e ) {
121
121
throw new RuntimeException (e );
@@ -440,7 +440,7 @@ public B setRetryableStatusCodes(final ImmutableSet<Integer> value) {
440
440
441
441
/**
442
442
* Sets whether to enable request compression.
443
- * Optional. Defaults to true .
443
+ * Optional. Defaults to false .
444
444
*
445
445
* @param value true to enable compression
446
446
* @return This instance of {@link Builder}.
@@ -453,7 +453,7 @@ public B setEnableCompression(final Boolean value) {
453
453
/**
454
454
* Protected constructor for subclasses.
455
455
*
456
- * @param targetConstructor The constructor for the concrete type to be created by this builder .
456
+ * @param targetConstructor The constructor for this builder to create the concrete type .
457
457
*/
458
458
protected Builder (final Function <B , S > targetConstructor ) {
459
459
super (targetConstructor );
@@ -542,7 +542,7 @@ public boolean isSatisfied(
542
542
* @param bodySize The size of the request body in bytes.
543
543
* @param encodedSize The size of the encoded request body in bytes.
544
544
*/
545
- record RequestInfo (Request request , long bodySize , long encodedSize ) { }
545
+ protected record RequestInfo (Request request , long bodySize , long encodedSize ) { }
546
546
547
547
static final class SerializedDatum {
548
548
SerializedDatum (final byte [] datum , final Optional <Long > populationSize ) {
0 commit comments