use of com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinIntFieldStrategyAnalyzer in project pinpoint by naver.
the class DataSourceCodec method encodeJoinDataSourceBo.
private void encodeJoinDataSourceBo(Buffer valueBuffer, List<JoinDataSourceBo> joinDataSourceBoList) {
final int numValues = joinDataSourceBoList.size();
valueBuffer.putVInt(numValues);
UnsignedShortEncodingStrategy.Analyzer.Builder serviceTypeAnalyzerBuilder = new UnsignedShortEncodingStrategy.Analyzer.Builder();
StringEncodingStrategy.Analyzer.Builder jdbcUrlAnalyzerBuilder = new StringEncodingStrategy.Analyzer.Builder();
JoinIntFieldStrategyAnalyzer.Builder activeConnectionSizeAnalyzerBuilder = new JoinIntFieldStrategyAnalyzer.Builder();
for (JoinDataSourceBo joinDataSourceBo : joinDataSourceBoList) {
serviceTypeAnalyzerBuilder.addValue(joinDataSourceBo.getServiceTypeCode());
jdbcUrlAnalyzerBuilder.addValue(joinDataSourceBo.getUrl());
activeConnectionSizeAnalyzerBuilder.addValue(joinDataSourceBo.getActiveConnectionSizeJoinValue());
}
StrategyAnalyzer<Short> serviceTypeAnalyzer = serviceTypeAnalyzerBuilder.build();
StrategyAnalyzer<String> jdbcUrlAnalyzer = jdbcUrlAnalyzerBuilder.build();
JoinIntFieldStrategyAnalyzer activeConnectionSizeAnalyzer = activeConnectionSizeAnalyzerBuilder.build();
AgentStatHeaderEncoder headerEncoder = new BitCountingHeaderEncoder();
headerEncoder.addCode(serviceTypeAnalyzer.getBestStrategy().getCode());
headerEncoder.addCode(jdbcUrlAnalyzer.getBestStrategy().getCode());
final byte[] codes = activeConnectionSizeAnalyzer.getBestStrategy().getCodes();
for (byte code : codes) {
headerEncoder.addCode(code);
}
final byte[] header = headerEncoder.getHeader();
valueBuffer.putPrefixedBytes(header);
this.codec.encodeValues(valueBuffer, serviceTypeAnalyzer.getBestStrategy(), serviceTypeAnalyzer.getValues());
this.codec.encodeValues(valueBuffer, jdbcUrlAnalyzer.getBestStrategy(), jdbcUrlAnalyzer.getValues());
this.codec.encodeValues(valueBuffer, activeConnectionSizeAnalyzer.getBestStrategy(), activeConnectionSizeAnalyzer.getValues());
}
Aggregations