
org.frameworkset.tran.metrics.job.BaseKeyMetrics Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bboss-datatran-metrics Show documentation
Show all versions of bboss-datatran-metrics Show documentation
bboss etl,datastream,Elasticsearch/Opensearch Client with restful and java api without elasticsearch jar dependended.
The newest version!
package org.frameworkset.tran.metrics.job;
/**
* Copyright 2020 bboss
*
* Licensed 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
*
* 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.
*/
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.Future;
/**
*
Description:
*
* Copyright (c) 2020
* @Date 2020/5/28 20:42
* @author biaoping.yin
* @version 1.0
*/
public abstract class BaseKeyMetrics {
private static Logger logger = LoggerFactory.getLogger(BaseKeyMetrics.class);
protected KeyMetricsPersistent metricsPersistent;
protected MetricsLogAPI metricsLogAPI;
public void setMetricsPersistent(KeyMetricsPersistent metricsPersistent) {
this.metricsPersistent = metricsPersistent;
}
public void setMetricsLogAPI(MetricsLogAPI metricsLogAPI) {
this.metricsLogAPI = metricsLogAPI;
}
public MetricsLogAPI getMetricsLogAPI() {
return metricsLogAPI;
}
/**
* s0和s1区域大小
*/
protected int segmentBoundSize = 100000;
/**
* 交换区s0
*/
protected KeyMetricsContainer keyMetricsContainerS0 ;
/**
* 交换区s1
*/
protected KeyMetricsContainer keyMetricsContainerS1 ;
public int getSegmentBoundSize() {
return segmentBoundSize;
}
public void setSegmentBoundSize(int segmentBoundSize) {
this.segmentBoundSize = segmentBoundSize;
}
protected KeyMetricsContainer buildKeyMetricsContainer(){
KeyMetricsContainer keyMetricsContainer = new KeyMetricsContainer();
keyMetricsContainer.setSegmentBoundSize(segmentBoundSize);
return keyMetricsContainer;
}
public void init(){
/**
* 交换区s0
*/
keyMetricsContainerS0 = buildKeyMetricsContainer();
/**
* 交换区s1
*/
keyMetricsContainerS1 = buildKeyMetricsContainer();
initMetrics();
}
protected abstract void initMetrics();
protected Future persistent(KeyMetricsContainer keyMetricsContainer){
return metricsPersistent.persistent( keyMetricsContainer.getKeyMetric().values());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy