Skip to content

Commit af74b24

Browse files
committed
remove backo, add failsafe
1 parent 205e2de commit af74b24

File tree

4 files changed

+139
-172
lines changed

4 files changed

+139
-172
lines changed

analytics/pom.xml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,18 @@
3939
<artifactId>findbugs</artifactId>
4040
<scope>provided</scope>
4141
</dependency>
42+
4243
<dependency>
43-
<groupId>com.segment.backo</groupId>
44-
<artifactId>backo</artifactId>
44+
<groupId>dev.failsafe</groupId>
45+
<artifactId>failsafe</artifactId>
46+
<version>3.3.2</version>
4547
</dependency>
48+
<dependency>
49+
<groupId>dev.failsafe</groupId>
50+
<artifactId>failsafe-retrofit</artifactId>
51+
<version>3.3.2</version>
52+
</dependency>
53+
4654
<dependency>
4755
<groupId>junit</groupId>
4856
<artifactId>junit</artifactId>

analytics/src/main/java/com/segment/analytics/Analytics.java

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ public static class Builder {
139139
private ThreadFactory threadFactory;
140140
private int flushQueueSize;
141141
private int maximumFlushAttempts;
142-
private int maximumQueueSizeInBytes;
143142
private long flushIntervalInMillis;
144143
private int queueCapacity;
145144
private boolean forceTlsV1 = false;
@@ -267,17 +266,6 @@ public Builder flushQueueSize(int flushQueueSize) {
267266
return this;
268267
}
269268

270-
/** Set the queueSize at which flushes should be triggered. */
271-
@Beta
272-
public Builder maximumQueueSizeInBytes(int bytes) {
273-
if (bytes < 1) {
274-
throw new IllegalArgumentException("maximumQueueSizeInBytes must not be less than 1.");
275-
}
276-
277-
this.maximumQueueSizeInBytes = bytes;
278-
return this;
279-
}
280-
281269
/** Set the interval at which the queue should be flushed. */
282270
@Beta
283271
public Builder flushInterval(long flushInterval, TimeUnit unit) {
@@ -369,9 +357,6 @@ public Analytics build() {
369357
if (flushQueueSize == 0) {
370358
flushQueueSize = Platform.get().defaultFlushQueueSize();
371359
}
372-
if (maximumQueueSizeInBytes == 0) {
373-
maximumQueueSizeInBytes = MESSAGE_QUEUE_MAX_BYTE_SIZE;
374-
}
375360
if (maximumFlushAttempts == 0) {
376361
maximumFlushAttempts = 3;
377362
}
@@ -430,20 +415,17 @@ public void log(String message) {
430415

431416
SegmentService segmentService = restAdapter.create(SegmentService.class);
432417

433-
AnalyticsClient analyticsClient =
434-
AnalyticsClient.create(
435-
endpoint,
436-
segmentService,
437-
queueCapacity,
438-
flushQueueSize,
439-
flushIntervalInMillis,
440-
maximumFlushAttempts,
441-
maximumQueueSizeInBytes,
442-
log,
443-
threadFactory,
444-
networkExecutor,
445-
writeKey,
446-
gson);
418+
AnalyticsClient analyticsClient = AnalyticsClient.create(
419+
endpoint,
420+
segmentService,
421+
queueCapacity,
422+
flushQueueSize,
423+
flushIntervalInMillis,
424+
log,
425+
threadFactory,
426+
networkExecutor,
427+
writeKey,
428+
gson);
447429

448430
return new Analytics(analyticsClient, messageTransformers, messageInterceptors, log);
449431
}

0 commit comments

Comments
 (0)