Search in sources :

Example 1 with ESClient

use of com.creditease.uav.elasticsearch.client.ESClient in project uavstack by uavorg.

the class ThreadAnalysisServer method stop.

@Override
public void stop() {
    // close ESClient
    ESClient client = (ESClient) this.getConfigManager().getComponent(this.feature, "ESClient");
    if (client != null) {
        client.close();
    }
    // stop ThreadAnalysisQueryServerWorker
    if (jtaQueryServerWorker != null) {
        jtaQueryServerWorker.stop();
        if (log.isTraceEnable()) {
            log.info(this, "ThreadAnalysisQueryServerWorker stop");
        }
    }
    super.stop();
}
Also used : ESClient(com.creditease.uav.elasticsearch.client.ESClient)

Example 2 with ESClient

use of com.creditease.uav.elasticsearch.client.ESClient 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");
        }
    }
}
Also used : StandardMessagingBuilder(org.uavstack.resources.common.messaging.StandardMessagingBuilder) ArrayBlockingQueue(java.util.concurrent.ArrayBlockingQueue) ESClient(com.creditease.uav.elasticsearch.client.ESClient) IOException(java.io.IOException) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) NewLogQueryServerWorker(com.creditease.uav.healthmanager.newlog.http.NewLogQueryServerWorker)

Example 3 with ESClient

use of com.creditease.uav.elasticsearch.client.ESClient in project uavstack by uavorg.

the class InvokeChainProcessServer method stop.

@Override
public void stop() {
    // close ESClient
    ESClient client = (ESClient) this.getConfigManager().getComponent(this.feature, "ESClient");
    if (client != null) {
        client.close();
    }
    // stop InvokeChainQueryServerWorker
    if (ivcQueryServerWorker != null) {
        ivcQueryServerWorker.stop();
        if (log.isTraceEnable()) {
            log.info(this, "InvokeChainQueryServerWorker stop");
        }
    }
    // remove cacheManager
    CacheManager cm = (CacheManager) this.getConfigManager().getComponent(this.feature, "IVCCacheManager");
    if (cm != null) {
        cm.shutdown();
    }
    this.getConfigManager().unregisterComponent(this.feature, "IVCCacheManager");
    // shutdown NodeOperActionEngine
    this.getActionEngineMgr().shutdown("SlowOperActionEngine");
    super.stop();
}
Also used : ESClient(com.creditease.uav.elasticsearch.client.ESClient) CacheManager(com.creditease.uav.cache.api.CacheManager)

Example 4 with ESClient

use of com.creditease.uav.elasticsearch.client.ESClient in project uavstack by uavorg.

the class HMNewLogService method stop.

@Override
public void stop() {
    // stop logDataConsumer
    if (this.logDataConsumer != null) {
        logDataConsumer.shutdown();
        this.getConfigManager().unregisterComponent(this.feature, "NewlogDataConsumer");
        if (log.isTraceEnable()) {
            log.info(this, "HMNewLogService LogConsumer shutdown");
        }
    }
    // close ESClient
    ESClient client = (ESClient) this.getConfigManager().getComponent(this.feature, "ESClient");
    if (client != null) {
        client.close();
    }
    // stop NewLogQueryServerWorker
    if (queryServer != null) {
        queryServer.stop();
        if (log.isTraceEnable()) {
            log.info(this, "NewLogQueryServerWorker stop");
        }
    }
    super.stop();
}
Also used : ESClient(com.creditease.uav.elasticsearch.client.ESClient)

Example 5 with ESClient

use of com.creditease.uav.elasticsearch.client.ESClient in project uavstack by uavorg.

the class InvokeChainProcessServer method start.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void start() {
    // init cache manager
    String cacheServerAddress = this.getConfigManager().getFeatureConfiguration(this.feature, "store.addr");
    int minConcurrent = DataConvertHelper.toInt(this.getConfigManager().getFeatureConfiguration(this.feature, "store.concurrent.min"), 10);
    int maxConcurrent = DataConvertHelper.toInt(this.getConfigManager().getFeatureConfiguration(this.feature, "store.concurrent.max"), 50);
    int queueSize = DataConvertHelper.toInt(this.getConfigManager().getFeatureConfiguration(this.feature, "store.concurrent.bqsize"), 5);
    String password = this.getConfigManager().getFeatureConfiguration(this.feature, "store.concurrent.pwd");
    CacheManager cm = CacheManagerFactory.build(cacheServerAddress, minConcurrent, maxConcurrent, queueSize, password);
    this.getConfigManager().registerComponent(this.feature, "IVCCacheManager", cm);
    // 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 invokechain index mgr
    new InvokeChainIndexMgr("InvokeChainIndexMgr", feature);
    // register slowoper index mgr
    new SlowOperIndexMgr("SlowOperIndexMgr", feature);
    // register invokechain collect handler
    new InvokeChainDataCollectHandler("JQ_IVC_CollectHandler", feature);
    // 注册重调用链action engine
    this.getActionEngineMgr().newActionEngine("SlowOperActionEngine", feature);
    // register slowoper collect handler
    new SlowOperDataCollectHandler("JQ_SLW_CollectHandler", feature);
    // run InvokeChainQueryServerWorker
    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"), 7799);
        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);
        ivcQueryServerWorker = new InvokeChainQueryServerWorker("InvokeChainQueryServerWorker", feature, "qhandlers");
        ThreadPoolExecutor executor = new ThreadPoolExecutor(core, max, 30, TimeUnit.SECONDS, new ArrayBlockingQueue(bqsize));
        ivcQueryServerWorker.start(executor, port, backlog);
        if (log.isTraceEnable()) {
            log.info(this, "InvokeChainQueryServerWorker started");
        }
    }
}
Also used : SlowOperDataCollectHandler(com.creditease.uav.invokechain.collect.SlowOperDataCollectHandler) InvokeChainQueryServerWorker(com.creditease.uav.invokechain.http.InvokeChainQueryServerWorker) ArrayBlockingQueue(java.util.concurrent.ArrayBlockingQueue) ESClient(com.creditease.uav.elasticsearch.client.ESClient) CacheManager(com.creditease.uav.cache.api.CacheManager) InvokeChainDataCollectHandler(com.creditease.uav.invokechain.collect.InvokeChainDataCollectHandler) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor)

Aggregations

ESClient (com.creditease.uav.elasticsearch.client.ESClient)6 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)3 CacheManager (com.creditease.uav.cache.api.CacheManager)2 ArrayBlockingQueue (java.util.concurrent.ArrayBlockingQueue)2 NewLogQueryServerWorker (com.creditease.uav.healthmanager.newlog.http.NewLogQueryServerWorker)1 InvokeChainDataCollectHandler (com.creditease.uav.invokechain.collect.InvokeChainDataCollectHandler)1 SlowOperDataCollectHandler (com.creditease.uav.invokechain.collect.SlowOperDataCollectHandler)1 InvokeChainQueryServerWorker (com.creditease.uav.invokechain.http.InvokeChainQueryServerWorker)1 ThreadAnalysisQueryServerWorker (com.creditease.uav.threadanalysis.http.ThreadAnalysisQueryServerWorker)1 ThreadAnalysisCollectDataHandler (com.creditease.uav.threadanalysis.server.collect.ThreadAnalysisCollectDataHandler)1 IOException (java.io.IOException)1 StandardMessagingBuilder (org.uavstack.resources.common.messaging.StandardMessagingBuilder)1