Skip to content

Commit 9701d79

Browse files
LaunchDarklyReleaseBoteli-darklyLaunchDarklyCIgwhelanLDLaunchDarklyReleaseBot
authored
prepare 3.0.0 release (#79)
* add time threshold for backoff reset * allow endpoint to be specified as either URI or HttpUrl * add @SInCE * add interface for customizing requests * javadoc fixes * add changelog for past releases * remove JSR305 * replace SSL-specific config method with general-purpose HTTP config method * make helper method static * add end-to-end EventSource tests * spacing * omit default header value if there's a custom value * avoid trailing period in logger name * add 1.x branch * update to OkHttp 4.x and Java 8 * javadoc fixes * remove EventSource setters, + test improvements * update Gradle release * enable Github Pages * skip tests in release * add ability to force a stream restart; improve tests so we can test this * revert whitespace change * bump OkHttp version to latest Java 7-compatible version * add ability to force a stream restart; improve tests so we can test this (#29) * update to okhttp 4.5.0 * longer timeout for cleaner shutdown of test servers * fix Gradle scopes * allow setting specific thread priority * remove misleading logging & unnecessary backoff, improve tests (#34) * known issue with onClose() - add comment, disable test assertions * allow caller to specify a custom logger instead of SLF4J (#32) * add method for changing base name of SLF4J logger * enable coverage reports in CI, improve CI to test all supported Java versions * rm inapplicable CI copy-paste * another CI fix * add checkstyle config * fix jitter calculation when upper bound is a power of 2 * misc coverage + test improvements, add CI enforcement of coverage (#39) * fix shutdown state logic, simplify code paths (#40) * Fix Java 7 compatibility. * add OpenJDK 7 build + fix test race condition + javadoc fix (#42) * update Gradle to 6.8.3 * Kotlinize build script * fix logic for shutting down after an unrecoverable error * use newer HTTP test helpers * use Releaser v2 config + newer CI images (#47) * use new stream-reading implementation to support CR-only line endings * make buffer size configurable * rm usage that's not allowed in Java 8 * add Guava test dependency * add code coverage ovverride * implement contract tests (#48) * use Gradle 7 * Bounded queues for the EventHandler thread (#58) * Bounded queue for the EventHandler thread The unbounded queue fronting the 'event' thread can cause trouble when the EventHandler is unable to keep up with the workload. This can lead to heap exhaustion, GC issues and failure modes that are generally considered "bad". Band-aid over this with a semaphore to limit the number of tasks in the queue. The semaphore is opt-in and disabled by default to avoid any nasty surprises for folks upgrading. Also add 'EventSource.awaitClosed()' to allow users to wait for underlying thread pools to completely shut down. We can't know if it's safe to clean up resources used by the EventHandler thread if we can't be certain that it has completely terminated. * Address checkstyle griping in StubServer * Fix JavaDoc issue * Tighten up exception handling Co-authored-by: Eli Bishop <[email protected]> * update @SInCE * test Java 17 in CI (#51) * improve tests for AsyncEventHandler and EventSource.awaitClosed (#52) * add streaming data mode for very large events (#53) * add option to ensure that expected fields are always read * add Gradle option to suppress kotlin-stdlib in our pom * update okhttp to 4.9.3 * use LaunchDarkly logging facade * rm unused * misc fixes * improve javadoc links * remove SLF4J dependency, use only com.launchdarkly.logging * update com.launchdarkly.logging version * consistently use placeholders instead of concatenation in log output * update release metadata * use SecureRandom instead of Random, just to make scanners happier * use SecureRandom instead of Random, just to make scanners happier * use SecureRandom instead of Random, just to make scanners happier * fix release metadata * remove usage of Duration for Android compatibility Co-authored-by: Eli Bishop <[email protected]> Co-authored-by: LaunchDarklyCI <[email protected]> Co-authored-by: Gavin Whelan <[email protected]> Co-authored-by: LaunchDarklyReleaseBot <[email protected]> Co-authored-by: Tom Lee <[email protected]>
1 parent e6b0132 commit 9701d79

File tree

13 files changed

+169
-459
lines changed

13 files changed

+169
-459
lines changed

build.gradle.kts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,13 @@ java {
6161
}
6262

6363
object Versions {
64-
const val launchdarklyLogging = "1.1.0"
64+
const val launchdarklyLogging = "1.1.1"
6565
const val okhttp = "4.9.3"
66-
const val slf4j = "1.7.22"
6766
}
6867

6968
dependencies {
7069
api("com.launchdarkly:launchdarkly-logging:${Versions.launchdarklyLogging}")
7170
api("com.squareup.okhttp3:okhttp:${Versions.okhttp}")
72-
api("org.slf4j:slf4j-api:${Versions.slf4j}")
73-
// SLF4J is no longer referenced directly by okhttp-eventsource, but since the default behavior is
74-
// to use the SLF4J adapter from com.launchdarkly.logging, we are still retaining the dependency
75-
// here to make sure it is in the classpath.
7671
testImplementation("org.mockito:mockito-core:1.10.19")
7772
testImplementation("com.launchdarkly:test-helpers:1.0.0")
7873
testImplementation("com.google.guava:guava:30.1-jre")
@@ -129,19 +124,14 @@ tasks.jacocoTestCoverageVerification.configure {
129124
// The key for each of these items is the complete method signature minus the "com.launchdarkly.eventsource." prefix.
130125
"AsyncEventHandler.acquire()" to 2,
131126
"AsyncEventHandler.execute(java.lang.Runnable)" to 3,
132-
"EventSource.awaitClosed(java.time.Duration)" to 3,
127+
"EventSource.awaitClosed(long, java.util.concurrent.TimeUnit)" to 2,
128+
"EventSource.awaitClosed(java.time.Duration)" to 1,
133129
"EventSource.handleSuccessfulResponse(okhttp3.Response)" to 2,
134130
"EventSource.maybeReconnectDelay(int, long)" to 2,
135131
"EventSource.run()" to 3,
136132
"EventSource.Builder.createInitialClientBuilder()" to 1,
137133
"EventSource.Builder.defaultTrustManager()" to 2,
138-
"EventSource.Builder.loggerBaseName(java.lang.String)" to 2,
139-
"LoggerBridge.ChannelImpl.log(com.launchdarkly.logging.LDLogLevel, java.lang.String, java.lang.Object[])" to 7,
140-
"LoggerBridge.ChannelImpl.log(com.launchdarkly.logging.LDLogLevel, java.lang.String, java.lang.Object)" to 7,
141-
"LoggerBridge.ChannelImpl.log(com.launchdarkly.logging.LDLogLevel, java.lang.Object)" to 7,
142-
"LoggerBridge.ChannelImpl.isEnabled(com.launchdarkly.logging.LDLogLevel)" to 1,
143134
"MessageEvent.getData()" to 2,
144-
"SLF4JLogger.error(java.lang.String)" to 2,
145135
"ModernTLSSocketFactory.createSocket(java.lang.String, int)" to 1,
146136
"ModernTLSSocketFactory.createSocket(java.lang.String, int, java.net.InetAddress, int)" to 1,
147137
"ModernTLSSocketFactory.createSocket(java.net.InetAddress, int)" to 1,

contract-tests/service/src/main/java/ssetest/StreamEntity.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import com.launchdarkly.eventsource.*;
44
import com.launchdarkly.logging.*;
55
import java.net.URI;
6-
import java.time.Duration;
76
import java.util.concurrent.atomic.AtomicInteger;
87

98
import okhttp3.*;
@@ -36,10 +35,10 @@ public StreamEntity(TestService owner, String id, StreamOptions options, LDLogAd
3635
eb.headers(hb.build());
3736
}
3837
if (options.initialDelayMs != null) {
39-
eb.reconnectTime(Duration.ofMillis(options.initialDelayMs));
38+
eb.reconnectTime(options.initialDelayMs, null);
4039
}
4140
if (options.readTimeoutMs != null) {
42-
eb.readTimeout(Duration.ofMillis(options.readTimeoutMs));
41+
eb.readTimeout(options.readTimeoutMs, null);
4342
}
4443
if (options.lastEventId != null) {
4544
eb.lastEventId(options.lastEventId);
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package com.launchdarkly.eventsource;
22

3-
import java.time.Duration;
4-
53
interface ConnectionHandler {
6-
void setReconnectionTime(Duration reconnectionTime);
4+
void setReconnectTimeMillis(long reconnecTimeMillis);
75
void setLastEventId(String lastEventId);
86
}

src/main/java/com/launchdarkly/eventsource/EventParser.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import java.io.PipedOutputStream;
1111
import java.io.UnsupportedEncodingException;
1212
import java.net.URI;
13-
import java.time.Duration;
1413
import java.util.Set;
1514
import java.util.regex.Pattern;
1615

@@ -229,7 +228,7 @@ public boolean processStream() throws IOException {
229228
break;
230229
case RETRY:
231230
if (DIGITS_ONLY.matcher(fieldValue).matches()) {
232-
connectionHandler.setReconnectionTime(Duration.ofMillis(Long.parseLong(fieldValue)));
231+
connectionHandler.setReconnectTimeMillis(Long.parseLong(fieldValue));
233232
}
234233
break;
235234
default:

0 commit comments

Comments
 (0)