use of com.creditease.agent.feature.notifycenter.actions.ThreadAnalysisAction in project uavstack by uavorg.
the class NotificationCenter method start.
@Override
public void start() {
engine = this.getActionEngineMgr().newActionEngine("NotifyActionEngine", feature);
// init actions
new SMSAction(NCConstant.ACTION4SMS, this.feature, engine);
String mailProvider = this.getConfigManager().getFeatureConfiguration(this.feature, "nc.notify.mail.provider");
if (StringHelper.isEmpty(mailProvider) || "CEMail".equals(mailProvider)) {
new CEMailAction(NCConstant.ACTION4MAIL, this.feature, engine);
}
if ("JavaMail".equals(mailProvider)) {
new JavaMailAction(NCConstant.ACTION4MAIL, this.feature, engine);
}
new HttpCallAction(NCConstant.ACTION4HTTP, this.feature, engine);
new PushNotifyEventAction(NCConstant.ACTION4PUSHNTF, this.feature, engine);
new ThreadAnalysisAction(NCConstant.ACTION4THREADANALYSIS, this.feature, engine);
String cacheServerAddress = this.getConfigManager().getFeatureConfiguration(this.feature, "nc.cache.addr");
String password = this.getConfigManager().getFeatureConfiguration(this.feature, "nc.cache.concurrent.pwd");
int minConcurrent = DataConvertHelper.toInt(this.getConfigManager().getFeatureConfiguration(this.feature, "nc.cache.concurrent.min"), 10);
int maxConcurrent = DataConvertHelper.toInt(this.getConfigManager().getFeatureConfiguration(this.feature, "nc.cache.concurrent.max"), 20);
int queueSize = DataConvertHelper.toInt(this.getConfigManager().getFeatureConfiguration(this.feature, "nc.cache.concurrent.bqsize"), 10);
// cache manager
cm = CacheManagerFactory.build(cacheServerAddress, minConcurrent, maxConcurrent, queueSize, password);
this.getConfigManager().registerComponent(this.feature, "NCCacheManager", cm);
new NCEventStatusManager("EventStatusManager", this.feature, cm);
// start I1NQueueWorkerMgr
int coreSize = DataConvertHelper.toInt(this.getConfigManager().getFeatureConfiguration(this.feature, "inqw.coreSize"), 10);
int maxSize = DataConvertHelper.toInt(this.getConfigManager().getFeatureConfiguration(this.feature, "inqw.maxSize"), 10);
int bQueueSize = DataConvertHelper.toInt(this.getConfigManager().getFeatureConfiguration(this.feature, "inqw.bQueueSize"), 10000);
int keepAliveTimeout = DataConvertHelper.toInt(this.getConfigManager().getFeatureConfiguration(this.feature, "inqw.keepAliveTimeout"), 10000);
I1NQueueWorkerMgr mgt = this.get1NQueueWorkerMgr();
I1NQueueWorker INqueueworker = mgt.newQueueWorker(NCConstant.NC1NQueueWorkerName, this.feature, coreSize, maxSize, bQueueSize, keepAliveTimeout);
notifyCenter_inqw = Executors.newSingleThreadExecutor();
notifyCenter_inqw.execute(INqueueworker);
if (log.isTraceEnable()) {
log.info(this, NCConstant.NC1NQueueWorkerName + " started");
}
NCJudgementEngine = this.getActionEngineMgr().newActionEngine("NCJudgementEngine", feature);
// start NCJudgementWorker
NCJudgementWorker ncj = new NCJudgementWorker("NCJudgementWorker", this.feature, "notifycenterhandlers");
notifyCenter_ncj = Executors.newSingleThreadExecutor();
notifyCenter_ncj.execute(ncj);
if (log.isTraceEnable()) {
log.info(this, "NCJudgementWorker started");
}
// Start the NC Http service
int port = DataConvertHelper.toInt(this.getConfigManager().getFeatureConfiguration(this.feature, "http.port"), 8766);
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"), 50);
int bqsize = DataConvertHelper.toInt(this.getConfigManager().getFeatureConfiguration(this.feature, "http.bqsize"), 10);
ncServerListenWorker = new NCHttpServerWorker("NCHttpServerWorker", this.feature, "nchttpHandler");
@SuppressWarnings({ "rawtypes", "unchecked" }) ThreadPoolExecutor exe = new ThreadPoolExecutor(core, max, 30000, TimeUnit.MILLISECONDS, new ArrayBlockingQueue(bqsize));
ncServerListenWorker.start(exe, port, backlog);
if (log.isTraceEnable()) {
log.info(this, "NCHttpServerWorker started");
}
}
Aggregations