Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit 3b391b6

Browse files
prepare 4.9.1 release (#176)
1 parent f996de4 commit 3b391b6

File tree

7 files changed

+703
-227
lines changed

7 files changed

+703
-227
lines changed

src/main/java/com/launchdarkly/client/DefaultEventProcessor.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import org.slf4j.LoggerFactory;
99

1010
import java.io.IOException;
11+
import java.io.StringWriter;
1112
import java.text.ParseException;
1213
import java.text.SimpleDateFormat;
1314
import java.util.ArrayList;
@@ -489,7 +490,7 @@ private static final class SendEventsTask implements Runnable {
489490
private final BlockingQueue<FlushPayload> payloadQueue;
490491
private final AtomicInteger activeFlushWorkersCount;
491492
private final AtomicBoolean stopping;
492-
private final EventOutput.Formatter formatter;
493+
private final EventOutputFormatter formatter;
493494
private final Thread thread;
494495
private final SimpleDateFormat httpDateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz"); // need one instance per task because the date parser isn't thread-safe
495496

@@ -499,7 +500,7 @@ private static final class SendEventsTask implements Runnable {
499500
this.sdkKey = sdkKey;
500501
this.config = config;
501502
this.httpClient = httpClient;
502-
this.formatter = new EventOutput.Formatter(config.inlineUsersInEvents);
503+
this.formatter = new EventOutputFormatter(config);
503504
this.responseListener = responseListener;
504505
this.payloadQueue = payloadQueue;
505506
this.activeFlushWorkersCount = activeFlushWorkersCount;
@@ -518,9 +519,10 @@ public void run() {
518519
continue;
519520
}
520521
try {
521-
List<EventOutput> eventsOut = formatter.makeOutputEvents(payload.events, payload.summary);
522-
if (!eventsOut.isEmpty()) {
523-
postEvents(eventsOut);
522+
StringWriter stringWriter = new StringWriter();
523+
int outputEventCount = formatter.writeOutputEvents(payload.events, payload.summary, stringWriter);
524+
if (outputEventCount > 0) {
525+
postEvents(stringWriter.toString(), outputEventCount);
524526
}
525527
} catch (Exception e) {
526528
logger.error("Unexpected error in event processor: {}", e.toString());
@@ -538,12 +540,11 @@ void stop() {
538540
thread.interrupt();
539541
}
540542

541-
private void postEvents(List<EventOutput> eventsOut) {
542-
String json = config.gson.toJson(eventsOut);
543+
private void postEvents(String json, int outputEventCount) {
543544
String uriStr = config.eventsURI.toString() + "/bulk";
544545

545546
logger.debug("Posting {} event(s) to {} with payload: {}",
546-
eventsOut.size(), uriStr, json);
547+
outputEventCount, uriStr, json);
547548

548549
for (int attempt = 0; attempt < 2; attempt++) {
549550
if (attempt > 0) {

src/main/java/com/launchdarkly/client/EventOutput.java

Lines changed: 0 additions & 207 deletions
This file was deleted.

0 commit comments

Comments
 (0)