Solve compile error (#313)
* Fixed BrokerStatsServiceImpl class.
diff --git a/src/main/java/org/apache/pulsar/manager/service/impl/BrokerStatsServiceImpl.java b/src/main/java/org/apache/pulsar/manager/service/impl/BrokerStatsServiceImpl.java
index 99fa696..4e8114b 100644
--- a/src/main/java/org/apache/pulsar/manager/service/impl/BrokerStatsServiceImpl.java
+++ b/src/main/java/org/apache/pulsar/manager/service/impl/BrokerStatsServiceImpl.java
@@ -26,6 +26,7 @@
import org.apache.pulsar.manager.service.BrokersService;
import org.apache.pulsar.manager.service.ClustersService;
import org.apache.pulsar.manager.service.PulsarAdminService;
+import org.apache.pulsar.manager.utils.HttpUtil;
import org.apache.pulsar.manager.entity.ConsumerStatsEntity;
import org.apache.pulsar.manager.entity.ConsumersStatsRepository;
import org.apache.pulsar.manager.entity.EnvironmentEntity;
@@ -43,13 +44,13 @@
import java.util.List;
import java.util.Map;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
-import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@@ -66,6 +67,9 @@
@Value("${backend.directRequestHost}")
private String directRequestHost;
+ @Value("${backend.jwt.token}")
+ private String pulsarJwtToken;
+
@Value("${clear.stats.interval}")
private Long clearStatsInterval;
@@ -79,6 +83,8 @@
private final ConsumersStatsRepository consumersStatsRepository;
private final PulsarAdminService pulsarAdminService;
+ private static final Map<String, String> header = new HashMap<>();
+
@Autowired
public BrokerStatsServiceImpl(
EnvironmentsRepository environmentsRepository,
@@ -136,6 +142,7 @@
if (!url.contains("http://")) {
url = "http://" + url;
}
+ // TODO Use Pulsar Admin instead of HttpUtil.
String httpTestResult = HttpUtil.doGet( url + "/admin/v2/brokers/health", header);
if (httpTestResult == null) {
log.error("This service {} is down, please check", url);