Skip to content

Commit ab4d439

Browse files
hubert-shsieh
authored andcommitted
Fixes #324 by disabling health-check when splunk.hec.lb.poll.interval is negative.
1 parent f561c03 commit ab4d439

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/main/java/com/splunk/hecclient/LoadBalancer.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,15 @@ public LoadBalancer(HecConfig hecConfig, CloseableHttpClient client) {
6363
Runnable r = () -> {
6464
run();
6565
};
66-
scheduledExecutorService.scheduleWithFixedDelay(r, 0, this.hecConfig.getlbPollInterval(), TimeUnit.MILLISECONDS);
66+
67+
if (this.hecConfig.getlbPollInterval() > 0)
68+
{
69+
scheduledExecutorService.scheduleWithFixedDelay(r, 0, this.hecConfig.getlbPollInterval(), TimeUnit.MILLISECONDS);
70+
}
71+
else
72+
{
73+
log.info("Disabling out-of-band health-check");
74+
}
6775
}
6876

6977
public void setHttpClient(CloseableHttpClient httpClient) {

0 commit comments

Comments
 (0)