Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
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
11 changes: 8 additions & 3 deletions client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<parent>
<groupId>io.split.client</groupId>
<artifactId>java-client-parent</artifactId>
<version>4.18.0</version>
<version>4.18.1-rc5</version>
</parent>
<version>4.18.0</version>
<version>4.18.1-rc5</version>
<artifactId>java-client</artifactId>
<packaging>jar</packaging>
<name>Java Client</name>
Expand Down Expand Up @@ -171,7 +171,12 @@
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.4.4</version>
<version>5.5</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.core5</groupId>
<artifactId>httpcore5</artifactId>
<version>5.3.5</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,7 @@ private void verifyRates() {
if (_metricsRefreshRate < 30) {
throw new IllegalArgumentException("metricsRefreshRate must be >= 30: " + _metricsRefreshRate);
}

if(_telemetryRefreshRate < 60) {
throw new IllegalStateException("_telemetryRefreshRate must be >= 60");
}
Expand Down
25 changes: 17 additions & 8 deletions client/src/main/java/io/split/engine/common/PushManagerImp.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ public void start() {
} else {
_pushStatusTracker.forcePushDisable();
}
} catch (Exception e) {
_log.debug("Exception in PushManager start: " + e.getMessage());
} finally {
lock.unlock();
}
Expand All @@ -127,8 +129,9 @@ public void start() {
public void stop() {
try {
lock.lock();
_log.debug("Stopping PushManagerImp");
cleanUpResources();
} catch (Exception e) {
_log.debug("Exception in stopping push manager: " + e.getMessage());
} finally {
lock.unlock();
}
Expand All @@ -138,7 +141,6 @@ public void stop() {
public void scheduleConnectionReset() {
_log.debug(String.format("scheduleNextTokenRefresh in %s SECONDS", _expirationTime));
_nextTokenRefreshTask = _scheduledExecutorService.schedule(() -> {
_log.debug("Starting scheduleNextTokenRefresh ...");
stop();
start();
}, _expirationTime.get(), TimeUnit.SECONDS);
Expand All @@ -156,22 +158,29 @@ private boolean startSse(String token, String channels) {

@Override
public void startWorkers() {
_featureFlagsWorker.start();
_segmentWorker.start();
try {
_featureFlagsWorker.start();
_segmentWorker.start();
} catch (Exception e) {
_log.debug("Exception in starting workers: " + e.getMessage());
}
}

@Override
public void stopWorkers() {
_featureFlagsWorker.stop();
_segmentWorker.stop();
try {
_featureFlagsWorker.stop();
_segmentWorker.stop();
} catch (Exception e) {
_log.debug("Exception in stopping workers: " + e.getMessage());
}
}

private void cleanUpResources() {
_eventSourceClient.stop();
stopWorkers();
if (_nextTokenRefreshTask != null) {
_log.debug("Cancel nextTokenRefreshTask");
_nextTokenRefreshTask.cancel(false);
}
}
}
}
20 changes: 8 additions & 12 deletions client/src/main/java/io/split/engine/sse/client/SSEClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.apache.hc.client5.http.classic.methods.HttpGet;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
import org.apache.hc.core5.io.CloseMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -115,19 +116,18 @@ public boolean isOpen() {
}

public void close() {
_log.debug("closing SSE client");
try {
lock.lock();
_forcedStop.set(true);
if (_state.compareAndSet(ConnectionState.OPEN, ConnectionState.CLOSED)) {
if (_ongoingResponse.get() != null) {
try {
_ongoingRequest.get().abort();
_ongoingResponse.get().close();
} catch (IOException e) {
_log.debug(String.format("SSEClient close forced: %s", e.getMessage()));
}
_ongoingRequest.get().abort();
_ongoingResponse.get().close(CloseMode.IMMEDIATE);
}
}
} catch (Exception e) {
_log.debug("Exception in closing SSE client: " + e.getMessage());
} finally {
lock.unlock();
}
Expand Down Expand Up @@ -184,19 +184,15 @@ private void connectAndLoop(URI uri, CountDownLatch signal) {
}
}
} catch (Exception e) { // Any other error non related to the connection disables streaming altogether
_log.debug(String.format("SSE connection exception: %s", e.getMessage()));
_telemetryRuntimeProducer
.recordStreamingEvents(new StreamingEvent(StreamEventsEnum.SSE_CONNECTION_ERROR.getType(),
StreamEventsEnum.SseConnectionErrorValues.NON_REQUESTED_CONNECTION_ERROR.getValue(),
System.currentTimeMillis()));
_log.warn(e.getMessage(), e);
_statusCallback.apply(StatusMessage.NONRETRYABLE_ERROR);
} finally {
try {
_ongoingResponse.get().close();
} catch (IOException e) {
_log.debug(e.getMessage());
}

_ongoingResponse.get().close(CloseMode.IMMEDIATE);
_state.set(ConnectionState.CLOSED);
_log.debug("SSEClient finished.");
_forcedStop.set(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ public Worker(String workerName) {

public void start() {
if (_running.compareAndSet(false, true)) {
_log.debug(String.format("%s Worker starting ...", _workerName));
_queue.clear();
_thread = new Thread( this);
_thread.setName(String.format("%s-worker", _workerName));
_thread.start();
_log.debug(String.format("%s Worker started ...", _workerName));
} else {
_log.debug(String.format("%s Worker already running.", _workerName));
return;
Expand Down
11 changes: 8 additions & 3 deletions okhttp-modules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<parent>
<artifactId>java-client-parent</artifactId>
<groupId>io.split.client</groupId>
<version>4.18.0</version>
<version>4.18.1-rc5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<version>4.18.0</version>
<version>4.18.1-rc5</version>
<artifactId>okhttp-modules</artifactId>
<packaging>jar</packaging>
<name>http-modules</name>
Expand Down Expand Up @@ -55,7 +55,12 @@
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.4.1</version>
<version>5.5</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.core5</groupId>
<artifactId>httpcore5</artifactId>
<version>5.3.5</version>
</dependency>
<!-- Test deps -->
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion pluggable-storage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>java-client-parent</artifactId>
<groupId>io.split.client</groupId>
<version>4.18.0</version>
<version>4.18.1-rc5</version>
</parent>

<version>2.1.0</version>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.split.client</groupId>
<artifactId>java-client-parent</artifactId>
<version>4.18.0</version>
<version>4.18.1-rc5</version>
<dependencyManagement>
<dependencies>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion redis-wrapper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>java-client-parent</artifactId>
<groupId>io.split.client</groupId>
<version>4.18.0</version>
<version>4.18.1-rc5</version>
</parent>
<artifactId>redis-wrapper</artifactId>
<version>3.1.1</version>
Expand Down
4 changes: 2 additions & 2 deletions testing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<parent>
<groupId>io.split.client</groupId>
<artifactId>java-client-parent</artifactId>
<version>4.18.0</version>
<version>4.18.1-rc5</version>
</parent>
<artifactId>java-client-testing</artifactId>
<packaging>jar</packaging>
<version>4.18.0</version>
<version>4.18.1-rc3</version>
<name>Java Client For Testing</name>
<description>Testing suite for Java SDK for Split</description>
<dependencies>
Expand Down