use of com.creditease.uav.healthmanager.newlog.http.NewLogQueryServerWorker in project uavstack by uavorg.
the class HMNewLogService method start.
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void start() {
/**
* INIT ESClient
*/
String esAddrStr = this.getConfigManager().getFeatureConfiguration(this.feature, "es.addr");
String clusterName = this.getConfigManager().getFeatureConfiguration(this.feature, "es.clustername");
ESClient client = new ESClient(esAddrStr, clusterName);
this.getConfigManager().registerComponent(this.feature, "ESClient", client);
/**
* HMNewLogIndexMgr
*/
new HMNewLogIndexMgr("HMNewLogIndexMgr", feature);
/**
* Log Consumer
*/
StandardMessagingBuilder smb = new StandardMessagingBuilder("HMCommonMsgBuilder", this.feature);
try {
smb.init("com.creditease.uav.healthmanager.newlog.handlers");
} catch (IOException e) {
log.err(this, "Read msgtype2topic.properties FAILs, HealthManager can not START", e);
return;
}
logDataConsumer = smb.buildConsumer(MonitorDataFrame.MessageType.Log.toString());
// start logDataConsumer
if (this.logDataConsumer != null) {
logDataConsumer.start();
this.getConfigManager().registerComponent(this.feature, "NewlogDataConsumer", logDataConsumer);
if (log.isTraceEnable()) {
log.info(this, "HMNewLogService LogConsumer started");
}
}
// run NewLogQueryServerWorker
boolean isStartQueryServer = DataConvertHelper.toBoolean(this.getConfigManager().getFeatureConfiguration(this.feature, "http.enable"), true);
if (isStartQueryServer == true) {
int port = DataConvertHelper.toInt(this.getConfigManager().getFeatureConfiguration(this.feature, "http.port"), 7899);
int backlog = DataConvertHelper.toInt(this.getConfigManager().getFeatureConfiguration(this.feature, "http.backlog"), 10);
int core = DataConvertHelper.toInt(this.getConfigManager().getFeatureConfiguration(this.feature, "http.core"), 10);
int max = DataConvertHelper.toInt(this.getConfigManager().getFeatureConfiguration(this.feature, "http.max"), 100);
int bqsize = DataConvertHelper.toInt(this.getConfigManager().getFeatureConfiguration(this.feature, "http.bqsize"), 10);
queryServer = new NewLogQueryServerWorker("NewLogQueryServerWorker", feature, "qhandlers");
ThreadPoolExecutor executor = new ThreadPoolExecutor(core, max, 30, TimeUnit.SECONDS, new ArrayBlockingQueue(bqsize));
queryServer.start(executor, port, backlog);
if (log.isTraceEnable()) {
log.info(this, "NewLogQueryServerWorker started");
}
}
}
Aggregations