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

prepare 4.7.1 release #169

Merged
merged 265 commits into from
Aug 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
265 commits
Select commit Hold shift + click to select a range
cca7d78
Merge pull request #81 from launchdarkly/eb/ch20410/extra-update
eli-darkly Jul 14, 2018
e4d155c
Merge branch 'master' of github.com:launchdarkly/java-client
eli-darkly Jul 17, 2018
992408f
Merge branch 'master' of github.com:launchdarkly/java-client
eli-darkly Jul 19, 2018
742514e
fix javadoc errors
eli-darkly Jul 20, 2018
b388b63
include explanations, if requested, in full feature request events
eli-darkly Jul 20, 2018
64fe12e
add unit test for reason property in full feature event
eli-darkly Jul 20, 2018
ebfb18a
add javadoc note about reasons in events
eli-darkly Jul 20, 2018
fd1b8d9
Merge pull request #82 from launchdarkly/eb/ch19787/explanations-in-e…
eli-darkly Jul 20, 2018
4810c14
add unit test to verify that the reason object can return a non-zero …
eli-darkly Aug 13, 2018
52951a8
always include ruleIndex in toString()
eli-darkly Aug 14, 2018
fa5df96
make sure kind property gets serialized to JSON
eli-darkly Aug 14, 2018
849f085
version 4.3.0-SNAPSHOT
eli-darkly Aug 14, 2018
2bae5ab
better error logging practices
eli-darkly Aug 16, 2018
361849c
add new version of allFlags() that captures more metadata
eli-darkly Aug 16, 2018
e3cfe15
Merge pull request #84 from launchdarkly/eb/ch22265/error-logging
eli-darkly Aug 16, 2018
1889fb5
clarify comment
eli-darkly Aug 16, 2018
1bcc8a3
Merge branch 'master' into eb/ch21386/all-flags-state-without-reasons
eli-darkly Aug 16, 2018
a4a5695
remove FOSSA upload step from CI
eli-darkly Aug 16, 2018
cc42ed6
Merge pull request #86 from launchdarkly/eb/disable-fossa
eli-darkly Aug 16, 2018
e4ae9cb
add evaluation reasons to allFlagsState()
eli-darkly Aug 16, 2018
de8b9e7
Merge branch 'master' into explanation
eli-darkly Aug 16, 2018
80f7197
Merge branch 'explanation' into eb/ch21386/all-flags-state-with-reasons
eli-darkly Aug 16, 2018
7e91572
rm duplicated test
eli-darkly Aug 16, 2018
a0dcfa7
add error explanation for malformed flags
eli-darkly Aug 16, 2018
712bed4
add tests for more error conditions
eli-darkly Aug 16, 2018
564db86
change options to be more enum-like
eli-darkly Aug 17, 2018
e29c2e0
version 4.2.2 (#88)
eli-darkly Aug 17, 2018
91f9cb2
add option to select only client-side flags in allFlagsState()
eli-darkly Aug 17, 2018
b0f034e
Merge branch 'master' of github.com:launchdarkly/java-client
eli-darkly Aug 17, 2018
a060bcc
fix comment
eli-darkly Aug 17, 2018
8939c8b
serialize FeatureFlagsState to a JsonElement, not a string
eli-darkly Aug 20, 2018
78611fb
rm unused import
eli-darkly Aug 20, 2018
8200e44
edit comment
eli-darkly Aug 20, 2018
bb20933
use custom Gson serializer
eli-darkly Aug 21, 2018
b82f58b
Merge branch 'eb/ch21386/all-flags-state-without-reasons' into eb/ch1…
eli-darkly Aug 21, 2018
20b2914
Merge pull request #85 from launchdarkly/eb/ch21386/all-flags-state-w…
eli-darkly Aug 22, 2018
190cdb9
add tests for JSON serialization of evaluation reasons
eli-darkly Aug 22, 2018
e90f90b
Merge pull request #87 from launchdarkly/eb/malformed-flag-error
eli-darkly Aug 22, 2018
bc5033a
Merge pull request #89 from launchdarkly/eb/ch12124/filter-client-sid…
eli-darkly Aug 22, 2018
b8b6a5b
Merge branch 'all-flags-state' into explanation
eli-darkly Aug 22, 2018
e35d149
Merge branch 'explanation' into eb/ch21386/all-flags-state-with-reasons
eli-darkly Aug 22, 2018
38f01cc
Merge branch 'explanation' into eb/reason-json-tests
eli-darkly Aug 22, 2018
8f90c71
misc cleanup
eli-darkly Aug 23, 2018
ccaddda
don't keep evaluating prerequisites if one fails
eli-darkly Aug 23, 2018
1d20039
Merge branch 'eb/single-prereq-failure' into eb/reason-json-tests
eli-darkly Aug 23, 2018
9a00c07
avoid some inappropriate uses of Guava's ImmutableMap
eli-darkly Aug 23, 2018
d026e18
make map & set in the User immutable
eli-darkly Aug 23, 2018
18ed2d6
fix default value logic
eli-darkly Aug 24, 2018
ab503e8
Merge pull request #94 from launchdarkly/eb/default-values
eli-darkly Aug 25, 2018
1de786b
Merge pull request #93 from launchdarkly/eb/immutable-maps
eli-darkly Aug 25, 2018
e9a31d0
Merge branch 'all-flags-state' into eb/ch21386/all-flags-state-with-r…
eli-darkly Aug 25, 2018
7de5305
Merge pull request #92 from launchdarkly/eb/single-prereq-failure
eli-darkly Aug 25, 2018
001f2e3
Merge pull request #91 from launchdarkly/eb/reason-json-tests
eli-darkly Aug 25, 2018
648a2e6
Merge pull request #90 from launchdarkly/eb/ch21386/all-flags-state-w…
eli-darkly Aug 25, 2018
4b98e50
Merge branch 'master' of github.com:launchdarkly/java-client
eli-darkly Aug 27, 2018
d21466c
javadoc fix
eli-darkly Aug 27, 2018
98cb3a6
Merge branch 'master' of github.com:launchdarkly/java-client
eli-darkly Aug 27, 2018
e0a41a5
make LDUser serialize correctly as JSON and add more test coverage
eli-darkly Aug 29, 2018
6abbb22
preserve prerequisite flag value in event even if flag was off
eli-darkly Aug 29, 2018
c18a1e1
more test coverage for requesting values of different types
eli-darkly Aug 29, 2018
aa38e77
Merge pull request #95 from launchdarkly/eb/ch22890/user-json
eli-darkly Sep 4, 2018
61effc7
Merge pull request #96 from launchdarkly/eb/ch22995/prereq-off
eli-darkly Sep 4, 2018
897aa62
Merge pull request #97 from launchdarkly/eb/ch23009/numeric-types
eli-darkly Sep 4, 2018
74834fe
Merge branch 'master' of github.com:launchdarkly/java-client
eli-darkly Sep 6, 2018
df6bde2
Merge branch 'master' of github.com:launchdarkly/java-client
eli-darkly Sep 6, 2018
00ad428
send correct event schema version
eli-darkly Sep 11, 2018
5573750
Merge pull request #98 from launchdarkly/eb/ch23827/event-version
eli-darkly Sep 11, 2018
af55687
merge from public after release
LaunchDarklyCI Sep 11, 2018
7c24d76
new option for sending less bootstrap data based on event tracking st…
eli-darkly Sep 26, 2018
41e429b
Merge pull request #99 from launchdarkly/eb/ch24449/less-bootstrap-data
eli-darkly Oct 1, 2018
4f9278b
merge from public after release
LaunchDarklyCI Oct 2, 2018
dcdad5e
change Gradle build to fix pom
eli-darkly Oct 13, 2018
5bba52a
misc build fixes
eli-darkly Oct 13, 2018
8af7519
misc fixes
eli-darkly Oct 14, 2018
2faeeb3
fix John's email
eli-darkly Oct 15, 2018
d2b8db0
Merge pull request #100 from launchdarkly/eb/ch13581/fix-pom
eli-darkly Oct 15, 2018
4a7d402
Merge branch 'master' of github.com:launchdarkly/java-client
eli-darkly Oct 17, 2018
d79ef2f
fix build so jar signatures will be published
eli-darkly Oct 18, 2018
e2021c9
Merge pull request #101 from launchdarkly/eb/fix-signing
eli-darkly Oct 18, 2018
352622c
merge from public after release
LaunchDarklyCI Oct 18, 2018
3ed7349
add file data source to Java SDK
eli-darkly Oct 19, 2018
e8ac5cc
formatting
eli-darkly Oct 19, 2018
071e0fc
formatting
eli-darkly Oct 19, 2018
5ad29f3
clarify comment
eli-darkly Oct 23, 2018
90e1bce
add link in readme
eli-darkly Oct 24, 2018
a607be1
Merge pull request #102 from launchdarkly/eb/ch25272/file-data-source
eli-darkly Oct 24, 2018
be41326
comment correction
eli-darkly Oct 24, 2018
2a3ead4
test that flags loaded from a file actually work
eli-darkly Oct 25, 2018
0e4ce02
add comment link
eli-darkly Oct 25, 2018
ca9fb99
Merge pull request #103 from launchdarkly/eb/ch25272/extra-test
eli-darkly Oct 26, 2018
bb5ef20
fix link URL
eli-darkly Oct 26, 2018
ff545df
merge from public after release
LaunchDarklyCI Oct 26, 2018
70d6a4e
added fossa build step
pkaeding Nov 16, 2018
e52c72f
empty commit
pkaeding Nov 16, 2018
e98f673
moved workflow filter definition
pkaeding Nov 16, 2018
e8c95aa
fixed docker image reference for fossa
pkaeding Nov 16, 2018
c481f30
give up on fossa-cli docker image
pkaeding Nov 16, 2018
cffdea7
added fossa.yml config
pkaeding Nov 16, 2018
6df4a6c
use v1 of fossa config?
pkaeding Nov 16, 2018
a2d8e0b
iterate on fossa config
pkaeding Nov 16, 2018
03ffa5d
run fossa init
pkaeding Nov 16, 2018
4c17f04
adapted fossa setup after seeing pr from fossa engineer
pkaeding Nov 17, 2018
fcbf66b
fixed sed command for fossa config
pkaeding Nov 17, 2018
5059856
removed sed nonsense since it isn't necessary
pkaeding Nov 17, 2018
fc24db5
let fossa figure out the sha, rather than passing it in from a circle…
pkaeding Nov 17, 2018
f04728d
Merge pull request #104 from launchdarkly/pk/ch26807/fix-fossa-integr…
pkaeding Nov 17, 2018
279a6b7
log stream errors as WARN, not ERROR
eli-darkly Nov 19, 2018
1c16129
publish test jar for shared tests
eli-darkly Nov 19, 2018
f92927c
add feature store support classes and use them in Redis
eli-darkly Nov 19, 2018
fa56386
comments
eli-darkly Nov 19, 2018
416c7dd
fix test
eli-darkly Nov 19, 2018
cc5efed
generate OSGi manifests semi-manually
eli-darkly Nov 20, 2018
94db999
fix build script so file data source package isn't shaded
eli-darkly Nov 20, 2018
7854de7
remove hard-coded package names, detect them from dependencies
eli-darkly Nov 20, 2018
1eb7084
don't try to access build products during configuration phase
eli-darkly Nov 20, 2018
facf198
comments
eli-darkly Nov 20, 2018
42f4329
Merge pull request #107 from launchdarkly/eb/fix-files-package
eli-darkly Nov 20, 2018
3668c38
Merge pull request #105 from launchdarkly/eb/ch19880/log-level
eli-darkly Nov 22, 2018
eeb2e20
merge from public after release
LaunchDarklyCI Nov 22, 2018
7203861
Merge pull request #106 from launchdarkly/eb/feature-store-support
eli-darkly Nov 22, 2018
beb8a1d
minor javadoc fixes
eli-darkly Nov 22, 2018
37d7b0b
misc changes for test support
eli-darkly Nov 22, 2018
64765c2
test fix
eli-darkly Nov 22, 2018
ee9b4c7
Merge branch 'master' into eb/ch15431/osgi
eli-darkly Nov 22, 2018
e82efc2
auto-discovery of imports and exports for shaded jars
eli-darkly Nov 22, 2018
4a26f93
add OSGi manifest to thin jar + misc refactoring
eli-darkly Nov 22, 2018
a997086
describe jar distributions
eli-darkly Nov 22, 2018
67cf59b
update other reference to version in readme
eli-darkly Nov 22, 2018
13aaa3a
Merge branch 'master' into eb/ch15431/osgi
eli-darkly Nov 22, 2018
f7f0d9a
rm Twisted
eli-darkly Nov 22, 2018
e66c590
misc fixes to jar configuration
eli-darkly Nov 23, 2018
9e33f90
add CI job to verify that we can build the jars
eli-darkly Nov 23, 2018
4515199
CI fix
eli-darkly Nov 23, 2018
da41de7
CI fix
eli-darkly Nov 23, 2018
d00d59e
CI fix
eli-darkly Nov 23, 2018
ead2f9b
CI fix
eli-darkly Nov 23, 2018
38255ca
skip signing jars in CI
eli-darkly Nov 23, 2018
6a0871d
CI fix
eli-darkly Nov 23, 2018
c0be7b2
CI fix
eli-darkly Nov 23, 2018
6aa4fde
add basic packaging tests
eli-darkly Nov 24, 2018
25a8f8b
install make
eli-darkly Nov 24, 2018
f18c50b
verify that every subpackage in the SDK source code exists in the jars
eli-darkly Nov 24, 2018
5f6d9be
remove OSGi support for now
eli-darkly Nov 24, 2018
cc3b7b1
Revert "remove OSGi support for now"
eli-darkly Nov 24, 2018
ca324bf
misc improvements for OSGi build and testing
eli-darkly Nov 24, 2018
7ac7320
ensure that temp dir is created
eli-darkly Nov 24, 2018
9cfda83
comment
eli-darkly Nov 24, 2018
50dd76a
add vendor attribute
eli-darkly Nov 24, 2018
8caab84
misc reorganization + comments
eli-darkly Nov 24, 2018
97caed8
comment
eli-darkly Nov 24, 2018
8f53730
simplify test app build
eli-darkly Nov 24, 2018
10c8264
improvements to OSGi test app
eli-darkly Nov 24, 2018
88843a5
more accurate way of discovering packages from OSGi jars
eli-darkly Nov 24, 2018
e3f3197
OSGi test fixes
eli-darkly Nov 24, 2018
a3612b7
simplify things using some library code
eli-darkly Nov 24, 2018
2779298
more specific logic for property switch
eli-darkly Dec 4, 2018
1b4b345
Merge pull request #108 from launchdarkly/eb/ch15431/basic-packaging-…
eli-darkly Dec 4, 2018
3d15da9
Merge branch 'master' into eb/ch15431/osgi
eli-darkly Dec 4, 2018
8d690f0
Merge pull request #109 from launchdarkly/eb/ch15431/osgi
eli-darkly Dec 7, 2018
1c1af79
better abstraction of caching parameters
eli-darkly Dec 7, 2018
79a758e
fix doc comment
eli-darkly Dec 7, 2018
e088858
comment
eli-darkly Dec 7, 2018
f7f6bbe
javadoc fixes
eli-darkly Dec 7, 2018
a478796
better use of static instances
eli-darkly Dec 7, 2018
95b352d
use newer methods in test
eli-darkly Dec 7, 2018
7d38880
Merge pull request #110 from launchdarkly/eb/cache-parameters
eli-darkly Dec 7, 2018
9931858
add readme text about DNS cache
eli-darkly Dec 8, 2018
9caea4c
copyedit
eli-darkly Dec 8, 2018
30cad56
add Electron link
eli-darkly Dec 8, 2018
d44bf0e
simplify method signatures + some test fixes
eli-darkly Dec 10, 2018
59b56f5
Merge pull request #112 from launchdarkly/eb/feature-store-support-2
eli-darkly Dec 10, 2018
4f27eab
Merge pull request #111 from launchdarkly/eb/ch28024/dns-ttl-readme
eli-darkly Dec 11, 2018
c453aac
misc API cleanup
eli-darkly Dec 13, 2018
b17a239
use EventSource snapshot prior to release
eli-darkly Dec 13, 2018
e02d97c
use EventSource 1.9.0
eli-darkly Dec 13, 2018
f4413fb
fix broken unit test
eli-darkly Dec 13, 2018
4332550
Merge branch 'master' of github.com:launchdarkly/java-client
eli-darkly Dec 13, 2018
d5d822f
implement dependency ordering for feature store data
eli-darkly Jan 8, 2019
746bf56
fix accidental deletion
eli-darkly Jan 8, 2019
b5677ef
simplify ordering logic
eli-darkly Jan 9, 2019
d72c680
Merge pull request #113 from launchdarkly/eb/ch29197/dependency-ordering
eli-darkly Jan 12, 2019
3151b34
javadoc fix
eli-darkly Jan 14, 2019
2eb0faa
merge from public after release
LaunchDarklyCI Jan 14, 2019
d874798
reset changelog - release error
eli-darkly Jan 15, 2019
f4f1853
Merge branch 'master' of github.com:launchdarkly/java-client
eli-darkly Jan 15, 2019
b1b66d9
merge from public after release
LaunchDarklyCI Jan 15, 2019
0464fc8
add pipeline
hroederld Feb 5, 2019
23ae1ba
Merge pull request #114 from launchdarkly/hr/azure
hroederld Feb 5, 2019
91c846b
fix tool download for packaging tests
eli-darkly Feb 5, 2019
67beb27
Merge pull request #115 from launchdarkly/eb/ch31401/felix-test
eli-darkly Feb 5, 2019
9326cf5
add experimentation event overrides for rules and fallthrough
eli-darkly Feb 20, 2019
4a54961
fix test case
eli-darkly Feb 20, 2019
29716e6
Merge pull request #116 from launchdarkly/eb/ch32302/experimentation-…
eli-darkly Feb 20, 2019
67f4498
perform orderly shutdown of event processor if it dies; process queue…
eli-darkly Feb 21, 2019
3d7ab6b
still need to be able to wait on a shutdown message when closing
eli-darkly Feb 21, 2019
4d4c37b
Merge pull request #117 from launchdarkly/eb/ch32404/event-processor-…
eli-darkly Feb 21, 2019
52cd895
use long ints in summary event counters
eli-darkly Feb 21, 2019
082d2d4
Merge pull request #118 from launchdarkly/eb/ch25963/long-counters
eli-darkly Feb 21, 2019
1c49f9b
Revert "Merge pull request #116 from launchdarkly/eb/ch32302/experime…
eli-darkly Feb 21, 2019
9f3eac2
merge from public after release
LaunchDarklyCI Feb 21, 2019
5d208ae
track or identify without a valid user shouldn't send an event
eli-darkly Feb 22, 2019
c6cee01
Merge pull request #119 from launchdarkly/eb/ch32176/no-user-no-event
eli-darkly Feb 22, 2019
c84852d
Merge commit '4791702a70d4d70b8dcab4283131aa09652fa998'
eli-darkly Mar 13, 2019
f48fcaf
bump eventsource version so we're no longer getting JSR305 annotations
eli-darkly Mar 21, 2019
5f75259
remove special shading rule for javax annotations
eli-darkly Mar 21, 2019
cd1f8d8
Merge pull request #120 from launchdarkly/eb/ch34379/no-jsr305
eli-darkly Mar 21, 2019
d769aa4
merge from public after release
LaunchDarklyCI Mar 22, 2019
ebc6099
Removed .fossa.yml, removed fossa job from circleci, removed fossa ba…
torchhound Mar 29, 2019
221c10d
extract gradle properties clarification to separate PR
bwoskow-ld Apr 1, 2019
c0d7e5f
Merge pull request #123 from launchdarkly/bw/ch35262/gradle-propertie…
bwoskow-ld Apr 1, 2019
69ee4ed
Merge pull request #122 from launchdarkly/jc/remove-fossa
torchhound Apr 1, 2019
bbe805b
Merge branch 'master' of github.com:launchdarkly/java-server-sdk
bwoskow-ld Apr 26, 2019
157a709
artifact/repository rename + doc update (#125)
bwoskow-ld May 1, 2019
20573f6
Merge branch 'master' of github.com:launchdarkly/java-server-sdk
bwoskow-ld May 1, 2019
345506d
merge from public after release
LaunchDarklyCI May 1, 2019
786e432
Adding properties back to fix the latest failure in the java restwrap…
bwoskow-ld May 2, 2019
3a8fdf6
Merge branch 'master' of github.com:launchdarkly/java-server-sdk
bwoskow-ld May 2, 2019
139f083
Merge branch 'master' of github.com:launchdarkly/java-server-sdk
bwoskow-ld May 3, 2019
d5cca57
change mirror used to get felix (#127)
bwoskow-ld May 21, 2019
8c7cb63
Add circleci jobs for supported java versions (#128)
bwoskow-ld May 21, 2019
2cd6c19
Merge branch 'master' of github.com:launchdarkly/java-server-sdk
bwoskow-ld May 21, 2019
d7a7dae
Merge branch 'master' of github.com:launchdarkly/java-server-sdk
bwoskow-ld May 21, 2019
ad3de4c
merge from public after release
LaunchDarklyCI May 21, 2019
bb188bd
rename inputChannel and buffer to inbox and outbox
eli-darkly Jul 8, 2019
822dbaa
drop events if inbox is full
eli-darkly Jul 8, 2019
0af23e5
revert unintentional change
eli-darkly Jul 8, 2019
8c689d6
use a volatile boolean instead of an AtomicBoolean
eli-darkly Jul 8, 2019
d2f52f9
comment
eli-darkly Jul 8, 2019
50ae974
Merge pull request #129 from launchdarkly/eb/ch32404/full-event-inbox
eli-darkly Jul 10, 2019
d2b8e94
merge from public after release
LaunchDarklyCI Jul 10, 2019
d7f1724
deprecate samplingInterval
eli-darkly Aug 1, 2019
da03425
add password to Redis builder
eli-darkly Aug 1, 2019
b90ea52
Merge pull request #131 from launchdarkly/eb/ch38635/deprecate-sampling
eli-darkly Aug 1, 2019
fd5dcda
Merge branch 'master' of github.com:launchdarkly/java-client
eli-darkly Aug 1, 2019
1a8f40f
add polling mode tests and end-to-end streaming test
eli-darkly Aug 2, 2019
e70355a
revise custom TLS config implementation, add tests
eli-darkly Aug 2, 2019
b9aa701
rm test code
eli-darkly Aug 2, 2019
a6209c0
rm unused
eli-darkly Aug 2, 2019
7cddd94
change test cert properties for Azure compatibility
eli-darkly Aug 2, 2019
37c456e
Merge pull request #132 from launchdarkly/eb/ch45321/polling-tests
eli-darkly Aug 2, 2019
2ebf254
Merge pull request #133 from launchdarkly/eb/ch44325/tls-config
eli-darkly Aug 2, 2019
03a4dc2
Merge branch 'master' into eb/ch41263/redis-password
eli-darkly Aug 2, 2019
b4f9054
add Redis builder options for password, TLS, database
eli-darkly Aug 2, 2019
450868e
revert debugging changes
eli-darkly Aug 2, 2019
f59392c
Merge pull request #134 from launchdarkly/eb/ch41263/redis-password
eli-darkly Aug 2, 2019
0ffa58f
Merge branch 'master' of github.com:launchdarkly/java-client
eli-darkly Aug 3, 2019
d47af12
avoid concurrency problem with date parser for event responses
eli-darkly Aug 19, 2019
cdb18be
revert accidental deletion, fix test
eli-darkly Aug 19, 2019
6bdf490
Merge pull request #136 from launchdarkly/eb/ch46731/events-parse-error
eli-darkly Aug 19, 2019
c80e585
Merge branch 'master' of github.com:launchdarkly/java-server-sdk
eli-darkly Aug 19, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions src/main/java/com/launchdarkly/client/DefaultEventProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Random;
import java.util.concurrent.ArrayBlockingQueue;
Expand Down Expand Up @@ -178,7 +179,6 @@ public String toString() { // for debugging only
static final class EventDispatcher {
private static final int MAX_FLUSH_THREADS = 5;
private static final int MESSAGE_BATCH_SIZE = 50;
static final SimpleDateFormat HTTP_DATE_FORMAT = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz");

private final LDConfig config;
private final List<SendEventsTask> flushWorkers;
Expand Down Expand Up @@ -231,8 +231,8 @@ public void uncaughtException(Thread t, Throwable e) {

flushWorkers = new ArrayList<>();
EventResponseListener listener = new EventResponseListener() {
public void handleResponse(Response response) {
EventDispatcher.this.handleResponse(response);
public void handleResponse(Response response, Date responseDate) {
EventDispatcher.this.handleResponse(response, responseDate);
}
};
for (int i = 0; i < MAX_FLUSH_THREADS; i++) {
Expand Down Expand Up @@ -404,13 +404,9 @@ private void triggerFlush(EventBuffer outbox, BlockingQueue<FlushPayload> payloa
}
}

private void handleResponse(Response response) {
String dateStr = response.header("Date");
if (dateStr != null) {
try {
lastKnownPastTime.set(HTTP_DATE_FORMAT.parse(dateStr).getTime());
} catch (ParseException e) {
}
private void handleResponse(Response response, Date responseDate) {
if (responseDate != null) {
lastKnownPastTime.set(responseDate.getTime());
}
if (!isHttpErrorRecoverable(response.code())) {
disabled.set(true);
Expand Down Expand Up @@ -475,7 +471,7 @@ private static final class FlushPayload {
}

private static interface EventResponseListener {
void handleResponse(Response response);
void handleResponse(Response response, Date responseDate);
}

private static final class SendEventsTask implements Runnable {
Expand All @@ -487,6 +483,7 @@ private static final class SendEventsTask implements Runnable {
private final AtomicBoolean stopping;
private final EventOutput.Formatter formatter;
private final Thread thread;
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

SendEventsTask(String sdkKey, LDConfig config, EventResponseListener responseListener,
BlockingQueue<FlushPayload> payloadQueue, AtomicInteger activeFlushWorkersCount,
Expand Down Expand Up @@ -563,13 +560,25 @@ private void postEvents(List<EventOutput> eventsOut) {
continue;
}
}
responseListener.handleResponse(response);
responseListener.handleResponse(response, getResponseDate(response));
break;
} catch (IOException e) {
logger.warn("Unhandled exception in LaunchDarkly client when posting events to URL: " + request.url(), e);
continue;
}
}
}

private Date getResponseDate(Response response) {
String dateStr = response.header("Date");
if (dateStr != null) {
try {
return httpDateFormat.parse(dateStr);
} catch (ParseException e) {
logger.warn("Received invalid Date header from events service");
}
}
return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.hamcrest.Matcher;
import org.junit.Test;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.TimeUnit;

Expand Down Expand Up @@ -39,6 +40,7 @@ public class DefaultEventProcessorTest {
gson.fromJson("{\"key\":\"userkey\",\"name\":\"Red\"}", JsonElement.class);
private static final JsonElement filteredUserJson =
gson.fromJson("{\"key\":\"userkey\",\"privateAttrs\":[\"name\"]}", JsonElement.class);
private static final SimpleDateFormat httpDateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz");

// Note that all of these events depend on the fact that DefaultEventProcessor does a synchronous
// flush when it is closed; in this case, it's closed implicitly by the try-with-resources block.
Expand Down Expand Up @@ -594,7 +596,7 @@ private MockResponse eventsSuccessResponse() {
}

private MockResponse addDateHeader(MockResponse response, long timestamp) {
return response.addHeader("Date", EventDispatcher.HTTP_DATE_FORMAT.format(new Date(timestamp)));
return response.addHeader("Date", httpDateFormat.format(new Date(timestamp)));
}

private JsonArray getEventsFromLastRequest(MockWebServer server) throws Exception {
Expand Down