Do not try to connect to zookeeper if connection string is empty (#428)
Co-authored-by: Jakub Štiller <stiller@2n.cz>
This commit is contained in:
parent
b60ff8acf6
commit
69c034c793
1 changed files with 7 additions and 4 deletions
|
@ -7,6 +7,7 @@ import lombok.RequiredArgsConstructor;
|
|||
import lombok.extern.log4j.Log4j2;
|
||||
import org.I0Itec.zkclient.ZkClient;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
|
@ -17,11 +18,13 @@ public class ZookeeperService {
|
|||
|
||||
public boolean isZookeeperOnline(KafkaCluster kafkaCluster) {
|
||||
var isConnected = false;
|
||||
if (StringUtils.hasText(kafkaCluster.getZookeeper())) {
|
||||
var zkClient = getOrCreateZkClient(kafkaCluster);
|
||||
log.debug("Start getting Zookeeper metrics for kafkaCluster: {}", kafkaCluster.getName());
|
||||
if (zkClient != null) {
|
||||
isConnected = isZkClientConnected(zkClient);
|
||||
}
|
||||
}
|
||||
return isConnected;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue