use of com.dtp.adapter.web.handler.WebServerTpHandler in project dynamic-tp by lyh200.
the class DtpWebRefreshListener method onApplicationEvent.
@Override
public void onApplicationEvent(RefreshEvent event) {
ApplicationContext applicationContext = ApplicationContextHolder.getInstance();
if (!(applicationContext instanceof WebServerApplicationContext)) {
return;
}
try {
WebServerTpHandler webServerTpHandler = ApplicationContextHolder.getBean(WebServerTpHandler.class);
webServerTpHandler.updateWebServerTp(event.getDtpProperties());
} catch (Exception e) {
log.error("DynamicTp refresh, update web server thread pool failed.", e);
}
}
use of com.dtp.adapter.web.handler.WebServerTpHandler in project dynamic-tp by lyh200.
the class DtpWebCollectListener method onApplicationEvent.
@Override
public void onApplicationEvent(CollectEvent event) {
DtpProperties dtpProperties = event.getDtpProperties();
if (!dtpProperties.isEnabledCollect()) {
return;
}
try {
WebServerTpHandler webServerTpHandler = ApplicationContextHolder.getBean(WebServerTpHandler.class);
ThreadPoolStats poolStats = webServerTpHandler.getPoolStats();
if (poolStats == null) {
return;
}
CollectorHandler.getInstance().collect(poolStats, dtpProperties.getCollectorType());
} catch (Exception e) {
log.error("DynamicTp monitor, collect web server thread pool metrics failed.", e);
}
}
Aggregations