Skip to content

Commit 5c46f00

Browse files
committed
PR feedback
1 parent 5fabb24 commit 5c46f00

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/main/java/com/arpnetworking/tsdcore/model/RequestEntry.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public Builder setPopulationSize(final Optional<Long> value) {
112112
}
113113

114114
/**
115-
* Set the request body size. Cannot be null.
115+
* Set the request body size. Required. Cannot be null.
116116
*
117117
* @param value The request body size.
118118
* @return This {@link Builder} instance.
@@ -123,7 +123,7 @@ public Builder setRequestBodySize(final Long value) {
123123
}
124124

125125
/**
126-
* Set the request body encoded size. Cannot be null.
126+
* Set the request body encoded size. Required. Cannot be null.
127127
*
128128
* @param value The request body encoded size.
129129
* @return This {@link Builder} instance.
@@ -140,9 +140,9 @@ public Builder setRequestBodyEncodedSize(final Long value) {
140140
@NotNull
141141
private Optional<Long> _populationSize = Optional.empty();
142142
@NotNull
143-
private Long _requestBodySize = null;
143+
private Long _requestBodySize;
144144
@NotNull
145-
private Long _requestBodyEncodedSize = null;
145+
private Long _requestBodyEncodedSize;
146146
}
147147
}
148148

src/main/java/com/arpnetworking/tsdcore/sinks/HttpPostSink.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ public Object toLogValue() {
111111
protected RequestInfo createRequest(final AsyncHttpClient client, final byte[] serializedData) {
112112
final byte[] bodyData;
113113
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+
117117
gzipStream.write(serializedData);
118-
gzipStream.close();
118+
gzipStream.flush();
119119
bodyData = bos.toByteArray();
120120
} catch (final IOException e) {
121121
throw new RuntimeException(e);
@@ -440,7 +440,7 @@ public B setRetryableStatusCodes(final ImmutableSet<Integer> value) {
440440

441441
/**
442442
* Sets whether to enable request compression.
443-
* Optional. Defaults to true.
443+
* Optional. Defaults to false.
444444
*
445445
* @param value true to enable compression
446446
* @return This instance of {@link Builder}.
@@ -453,7 +453,7 @@ public B setEnableCompression(final Boolean value) {
453453
/**
454454
* Protected constructor for subclasses.
455455
*
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.
457457
*/
458458
protected Builder(final Function<B, S> targetConstructor) {
459459
super(targetConstructor);
@@ -542,7 +542,7 @@ public boolean isSatisfied(
542542
* @param bodySize The size of the request body in bytes.
543543
* @param encodedSize The size of the encoded request body in bytes.
544544
*/
545-
record RequestInfo(Request request, long bodySize, long encodedSize) { }
545+
protected record RequestInfo(Request request, long bodySize, long encodedSize) { }
546546

547547
static final class SerializedDatum {
548548
SerializedDatum(final byte[] datum, final Optional<Long> populationSize) {

0 commit comments

Comments
 (0)