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

Commit 78084f6

Browse files
committed
Log at error level, set the last heartbeat whenever a message is received
1 parent c195b64 commit 78084f6

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
All notable changes to the LaunchDarkly Java SDK will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).
55

6+
## [2.0.5] - 2016-11-09
7+
### Changed
8+
- The StreamProcessor now listens for heartbeats from the streaming API, and will automatically reconnect if heartbeats are not received.
9+
610
## [2.0.4] - 2016-10-12
711
### Changed
812
- Updated GSON dependency version to 2.7

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ repositories {
1919

2020
allprojects {
2121
group = 'com.launchdarkly'
22-
version = "2.0.4"
22+
version = "2.0.5"
2323
sourceCompatibility = 1.7
2424
targetCompatibility = 1.7
2525
}

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ public Future<Void> start() {
6161

6262
@Override
6363
public void onOpen() throws Exception {
64-
lastHeartbeat = DateTime.now();
6564
}
6665

6766
@Override
6867
public void onMessage(String name, MessageEvent event) throws Exception {
68+
lastHeartbeat = DateTime.now();
6969
Gson gson = new Gson();
7070
switch (name) {
7171
case PUT:
@@ -208,14 +208,13 @@ public void run() {
208208
try {
209209
logger.info("Stream stopped receiving heartbeats- reconnecting.");
210210
es.close();
211-
start();
212211
} catch (IOException e) {
213-
logger.warn("Encountered exception closing stream connection: " + e.getMessage());
212+
logger.error("Encountered exception closing stream connection: " + e.getMessage());
214213
} finally {
215214
if (es.getState() == ReadyState.SHUTDOWN) {
216215
start();
217216
} else {
218-
logger.warn("Expected ES to be in state SHUTDOWN, but it's currently in state " + es.getState().toString());
217+
logger.error("Expected ES to be in state SHUTDOWN, but it's currently in state " + es.getState().toString());
219218
}
220219
}
221220
}

0 commit comments

Comments
 (0)