Skip to content

Commit 7686d5f

Browse files
committed
chore: Log interrupted exception, address comment todo.
1 parent b50f684 commit 7686d5f

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

lib/sdk/server/src/main/java/com/launchdarkly/sdk/server/PollingBase.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ protected CompletableFuture<FDv2SourceResult> poll(Selector selector, boolean on
119119
);
120120
return FDv2SourceResult.changeSet(converted, fdv1Fallback);
121121
} catch (Exception e) {
122-
// TODO: Do we need to be more specific about the exception type here?
122+
// Whatever exception happened here means we couldn't handle the data. So we are going to
123+
// treat that as invalid data.
123124
DataSourceStatusProvider.ErrorInfo info = new DataSourceStatusProvider.ErrorInfo(
124125
DataSourceStatusProvider.ErrorKind.INVALID_DATA,
125126
0,

lib/sdk/server/src/main/java/com/launchdarkly/sdk/server/PollingSynchronizerImpl.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ class PollingSynchronizerImpl extends PollingBase implements Synchronizer {
1717

1818
private final IterableAsyncQueue<FDv2SourceResult> resultQueue = new IterableAsyncQueue<>();
1919

20+
private final LDLogger logger;
21+
2022
public PollingSynchronizerImpl(
2123
FDv2Requestor requestor,
2224
LDLogger logger,
@@ -25,6 +27,7 @@ public PollingSynchronizerImpl(
2527
Duration pollInterval
2628
) {
2729
super(requestor, logger.subLogger(Loggers.POLLING_SYNCHRONIZER));
30+
this.logger = logger;
2831
this.selectorSource = selectorSource;
2932

3033
synchronized (this) {
@@ -72,7 +75,9 @@ private void doPoll() {
7275
resultQueue.put(res);
7376
}
7477
} catch (InterruptedException | ExecutionException e) {
75-
// TODO: Determine if handling is needed.
78+
// If this happens, then the thread running the poll has been interrupted, or the task has been canceled.
79+
// This would likely be the result of a shutdown, so we are just logging this for debugging purposes.
80+
logger.debug("Polling thread interrupted: {}", e.toString());
7681
}
7782
}
7883

0 commit comments

Comments
 (0)