37
37
import com .google .common .collect .Lists ;
38
38
import net .sf .oval .constraint .Min ;
39
39
import net .sf .oval .constraint .NotNull ;
40
+ import org .joda .time .Period ;
40
41
import org .joda .time .format .ISOPeriodFormat ;
41
42
42
43
import java .io .ByteArrayOutputStream ;
@@ -181,10 +182,10 @@ private void addChunk(
181
182
private KairosDbSink (final Builder builder ) {
182
183
super (builder );
183
184
_maxRequestSize = builder ._maxRequestSize ;
184
- _ttlSeconds = ( int ) builder ._ttl .getSeconds ();
185
+ _ttlSeconds = builder ._ttl . toStandardSeconds () .getSeconds ();
185
186
_publishStandardMetrics = builder ._publishStandardMetrics ;
186
187
_publishHistograms = builder ._publishHistograms ;
187
- _histogramTtlSeconds = ( int ) builder ._histogramTtl .getSeconds ();
188
+ _histogramTtlSeconds = builder ._histogramTtl . toStandardSeconds () .getSeconds ();
188
189
}
189
190
190
191
private final int _maxRequestSize ;
@@ -521,7 +522,7 @@ public Builder setPublishHistograms(final Boolean value) {
521
522
* @param value the time to retain histograms
522
523
* @return This instance of {@link Builder}.
523
524
*/
524
- public Builder setTtl (final Duration value ) {
525
+ public Builder setTtl (final Period value ) {
525
526
_ttl = value ;
526
527
return this ;
527
528
}
@@ -534,7 +535,7 @@ public Builder setTtl(final Duration value) {
534
535
* @param value the time to retain histograms
535
536
* @return This instance of {@link Builder}.
536
537
*/
537
- public Builder setHistogramTtl (final Duration value ) {
538
+ public Builder setHistogramTtl (final Period value ) {
538
539
_histogramTtl = value ;
539
540
return this ;
540
541
}
@@ -547,8 +548,8 @@ public Builder setHistogramTtl(final Duration value) {
547
548
@ NotNull
548
549
private Boolean _publishHistograms = false ;
549
550
@ NotNull
550
- private Duration _histogramTtl = Duration . ofSeconds (0 );
551
+ private Period _histogramTtl = Period . seconds (0 );
551
552
@ NotNull
552
- private Duration _ttl = Duration . ofSeconds (0 );
553
+ private Period _ttl = Period . seconds (0 );
553
554
}
554
555
}
0 commit comments