MemoryPoolMinuteMetricPersistenceWorker.java 2.7 KB
Newer Older
P
peng-yongsheng 已提交
1
/*
wu-sheng's avatar
wu-sheng 已提交
2 3 4 5 6 7
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
P
peng-yongsheng 已提交
8 9 10 11 12 13 14 15 16 17 18
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

19
package org.apache.skywalking.apm.collector.analysis.jvm.provider.worker.memorypool;
20

P
peng-yongsheng 已提交
21
import org.apache.skywalking.apm.collector.analysis.jvm.define.graph.WorkerIdDefine;
22 23
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.MergePersistenceWorker;
import org.apache.skywalking.apm.collector.analysis.worker.model.impl.MergePersistenceWorkerProvider;
24
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
P
peng-yongsheng 已提交
25
import org.apache.skywalking.apm.collector.storage.StorageModule;
26
import org.apache.skywalking.apm.collector.storage.base.dao.IPersistenceDAO;
彭勇升 pengys 已提交
27
import org.apache.skywalking.apm.collector.storage.dao.mpool.IMemoryPoolMinuteMetricPersistenceDAO;
28
import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetric;
P
peng-yongsheng 已提交
29 30 31 32

/**
 * @author peng-yongsheng
 */
33
public class MemoryPoolMinuteMetricPersistenceWorker extends MergePersistenceWorker<MemoryPoolMetric> {
P
peng-yongsheng 已提交
34

P
peng-yongsheng 已提交
35
    @Override public int id() {
36
        return WorkerIdDefine.MEMORY_POOL_MINUTE_METRIC_PERSISTENCE_WORKER_ID;
P
peng-yongsheng 已提交
37 38
    }

39
    public MemoryPoolMinuteMetricPersistenceWorker(ModuleManager moduleManager) {
P
peng-yongsheng 已提交
40
        super(moduleManager);
P
peng-yongsheng 已提交
41 42 43
    }

    @Override protected boolean needMergeDBData() {
44
        return true;
P
peng-yongsheng 已提交
45 46
    }

P
peng-yongsheng 已提交
47 48
    @SuppressWarnings("unchecked")
    @Override protected IPersistenceDAO<?, ?, MemoryPoolMetric> persistenceDAO() {
49
        return getModuleManager().find(StorageModule.NAME).getService(IMemoryPoolMinuteMetricPersistenceDAO.class);
P
peng-yongsheng 已提交
50 51
    }

52
    public static class Factory extends MergePersistenceWorkerProvider<MemoryPoolMetric, MemoryPoolMinuteMetricPersistenceWorker> {
P
peng-yongsheng 已提交
53

P
peng-yongsheng 已提交
54 55
        public Factory(ModuleManager moduleManager) {
            super(moduleManager);
P
peng-yongsheng 已提交
56 57
        }

58 59
        @Override public MemoryPoolMinuteMetricPersistenceWorker workerInstance(ModuleManager moduleManager) {
            return new MemoryPoolMinuteMetricPersistenceWorker(moduleManager);
P
peng-yongsheng 已提交
60
        }
P
peng-yongsheng 已提交
61

P
peng-yongsheng 已提交
62 63 64 65
        @Override
        public int queueSize() {
            return 1024;
        }
P
peng-yongsheng 已提交
66 67
    }
}