use of com.creditease.uav.threadanalysis.http.ThreadAnalysisQueryServerWorker in project uavstack by uavorg.
the class ThreadAnalysisServer method start.
@Override
public void start() {
// init ES Client
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);
// register thread analysis index mgr
new ThreadAnalysisIndexMgr("ThreadAnalysisIndexMgr", feature);
// 初始化线程分析Handler对象
new ThreadAnalysisCollectDataHandler("JQ_JTA_CollectHandler", feature);
// run ThreadAnalysisQueryServerWorker
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"), 5566);
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);
jtaQueryServerWorker = new ThreadAnalysisQueryServerWorker("ThreadAnalysisQueryServerWorker", feature, "qhandlers");
ThreadPoolExecutor executor = new ThreadPoolExecutor(core, max, 30, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(bqsize));
jtaQueryServerWorker.start(executor, port, backlog);
if (log.isTraceEnable()) {
log.info(this, "ThreadAnalysisQueryServerWorker started");
}
}
// deep thread analysis
new ThreadAnalyser("ThreadAnalyser", feature);
}
Aggregations