Skip to content

Commit 97630f8

Browse files
committed
[#noissue] Cleanup
1 parent 8b5a741 commit 97630f8

File tree

5 files changed

+18
-16
lines changed

5 files changed

+18
-16
lines changed

web/src/main/java/com/navercorp/pinpoint/web/applicationmap/map/VirtualLinkHandler.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public LinkDataDuplexMap processVirtualLinks(LinkDataDuplexMap linkDataDuplexMap
5959
return linkDataDuplexMap;
6060
}
6161
logger.debug("Virtual link size : {}", virtualLinkDataSet.size());
62-
List<Application> unpopulatedEmulatedNodes = getUnpopulatedEmulatedNodes(linkDataDuplexMap.getTargetLinkDataMap(), virtualLinkDataSet);
62+
Collection<Application> unpopulatedEmulatedNodes = getUnpopulatedEmulatedNodes(linkDataDuplexMap.getTargetLinkDataMap(), virtualLinkDataSet);
6363
if (unpopulatedEmulatedNodes.isEmpty()) {
6464
logger.debug("unpopulated emulated node not found");
6565
} else {
@@ -75,15 +75,15 @@ public LinkDataDuplexMap processVirtualLinks(LinkDataDuplexMap linkDataDuplexMap
7575
return linkDataDuplexMap;
7676
}
7777

78-
private List<Application> getUnpopulatedEmulatedNodes(LinkDataMap targetLinkDataMap, Set<LinkData> virtualLinkDataSet) {
78+
private Collection<Application> getUnpopulatedEmulatedNodes(LinkDataMap targetLinkDataMap, Set<LinkData> virtualLinkDataSet) {
7979
Set<Application> unpopulatedEmulatedNodes = new HashSet<>();
8080
for (LinkData virtualLinkData : virtualLinkDataSet) {
8181
Application toApplication = virtualLinkData.getToApplication();
8282
if (targetLinkDataMap.getLinkData(new LinkKey(virtualLinkData.getFromApplication(), toApplication)) == null) {
8383
unpopulatedEmulatedNodes.add(toApplication);
8484
}
8585
}
86-
return new ArrayList<>(unpopulatedEmulatedNodes);
86+
return unpopulatedEmulatedNodes;
8787
}
8888

8989
private Collection<LinkData> getEmulatedNodeInLinkData(LinkVisitChecker linkVisitChecker, Application emulatedNode, TimeWindow timeWindow) {
@@ -95,12 +95,16 @@ private Collection<LinkData> getEmulatedNodeInLinkData(LinkVisitChecker linkVisi
9595
Application fromApplication = inLinkData.getFromApplication();
9696
// filter callee link data from non-WAS nodes
9797
if (!fromApplication.getServiceType().isWas()) {
98-
logger.trace("filtered {} as {} is not a WAS node", inLinkData, fromApplication);
98+
if (logger.isTraceEnabled()) {
99+
logger.trace("filtered {} as {} is not a WAS node", inLinkData, fromApplication);
100+
}
99101
continue;
100102
}
101103
// filter callee link data from nodes that haven't been visited as we don't need them
102104
if (!linkVisitChecker.isVisitedOut(fromApplication)) {
103-
logger.trace("filtered {} as {} is not in scope of the current server map", inLinkData, fromApplication);
105+
if (logger.isTraceEnabled()) {
106+
logger.trace("filtered {} as {} is not in scope of the current server map", inLinkData, fromApplication);
107+
}
104108
continue;
105109
}
106110
logger.debug("emulated node [{}] inLink LinkData:{}", emulatedNode, inLinkData);

web/src/main/java/com/navercorp/pinpoint/web/calltree/span/CallTreeIterator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ private CallTreeNode getNext() {
245245
}
246246

247247
public List<Align> values() {
248-
List<Align> values = new ArrayList<>();
248+
List<Align> values = new ArrayList<>(nodes.size());
249249
for (CallTreeNode node : nodes) {
250250
values.add(node.getAlign());
251251
}

web/src/main/java/com/navercorp/pinpoint/web/calltree/span/MetaSpanCallTreeFactory.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ public CallTree unknown(final long startTimeMillis) {
4949
rootSpan.setStartTime(startTimeMillis);
5050
rootSpan.setServiceType(ServiceType.UNKNOWN.getCode());
5151

52-
List<AnnotationBo> annotations = new ArrayList<>();
5352
ApiMetaDataBo apiMetaData = new ApiMetaDataBo(UNKNOWN_AGENT_ID, AGENT_START_TIME, 0, LineNumber.NO_LINE_NUMBER,
5453
MethodTypeEnum.WEB_REQUEST, "Unknown");
55-
5654
final AnnotationBo apiMetaDataAnnotation = AnnotationBo.of(AnnotationKey.API_METADATA.getCode(), apiMetaData);
57-
annotations.add(apiMetaDataAnnotation);
5855

5956
final AnnotationBo argumentAnnotation = AnnotationBo.of(AnnotationKeyUtils.getArgs(0).getCode(), "No Agent Data");
57+
58+
List<AnnotationBo> annotations = new ArrayList<>();
59+
annotations.add(apiMetaDataAnnotation);
6060
annotations.add(argumentAnnotation);
6161
rootSpan.setAnnotationBoList(annotations);
6262

@@ -74,18 +74,16 @@ public SpanCallTree corrupted(final String title, final long parentSpanId, final
7474
rootSpan.setApplicationName("CORRUPTED");
7575
rootSpan.setServiceType(ServiceType.UNKNOWN.getCode());
7676

77-
List<AnnotationBo> annotations = new ArrayList<>();
78-
7977
ApiMetaDataBo apiMetaData = new ApiMetaDataBo(CORRUPTED_AGENT_ID, AGENT_START_TIME, 0, LineNumber.NO_LINE_NUMBER,
8078
MethodTypeEnum.CORRUPTED, "...");
81-
8279
final AnnotationBo apiMetaDataAnnotation = AnnotationBo.of(AnnotationKey.API_METADATA.getCode(), apiMetaData);
83-
annotations.add(apiMetaDataAnnotation);
84-
8580

8681
int key = AnnotationKeyUtils.getArgs(0).getCode();
8782
String errorMessage = getErrorMessage(title, startTimeMillis);
8883
final AnnotationBo argumentAnnotation = AnnotationBo.of(key, errorMessage);
84+
85+
List<AnnotationBo> annotations = new ArrayList<>();
86+
annotations.add(apiMetaDataAnnotation);
8987
annotations.add(argumentAnnotation);
9088
rootSpan.setAnnotationBoList(annotations);
9189
return new MetaSpanCallTree(new SpanAlign(rootSpan, true));

web/src/main/java/com/navercorp/pinpoint/web/calltree/span/Node.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ private List<Align> buildAlignList(List<SpanEventBo> spanEventBoList) {
138138
return Collections.emptyList();
139139
}
140140

141-
List<Align> alignList = new ArrayList<>();
141+
List<Align> alignList = new ArrayList<>(spanEventBoList.size());
142142
for (SpanEventBo spanEventBo : spanEventBoList) {
143143
if (logger.isDebugEnabled()) {
144144
logger.debug("Populate spanEvent{seq={}, depth={}, event={}}", spanEventBo.getSequence(), spanEventBo.getDepth(), spanEventBo);

web/src/main/java/com/navercorp/pinpoint/web/service/ProxyRequestTypeRegistryServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public ProxyRequestTypeRegistryServiceImpl() {
7575
public void init() {
7676
final ClassLoader classLoader = ClassUtils.getDefaultClassLoader();
7777
final ServiceLoader<ProxyRequestMetadataProvider> serviceLoader = ServiceLoader.load(ProxyRequestMetadataProvider.class, classLoader);
78-
final List<ProxyRequestType> proxyRequestTypeList = new ArrayList<ProxyRequestType>();
78+
final List<ProxyRequestType> proxyRequestTypeList = new ArrayList<>();
7979
for (ProxyRequestMetadataProvider provider : serviceLoader) {
8080
final ProxyRequestMetadataSetupContext context = new ProxyRequestMetadataSetupContext() {
8181
@Override

0 commit comments

Comments
 (0)