fix RESOURCE_LEAK (#5616)
This commit is contained in:
parent
a785be4f2b
commit
5fa2ae4903
|
|
@ -209,4 +209,4 @@ public class AgentClassLoader extends ClassLoader {
|
|||
private final JarFile jarFile;
|
||||
private final File sourceFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -98,4 +98,4 @@ public class IgnoreConfigInitializer {
|
|||
}
|
||||
throw new ConfigNotFoundException("Fail to load ignore config file.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -39,23 +39,24 @@ public class SpanProcessor {
|
|||
}
|
||||
|
||||
void convert(ZipkinReceiverConfig config, SpanBytesDecoder decoder, HttpServletRequest request) throws IOException {
|
||||
InputStream inputStream = getInputStream(request);
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
byte[] buffer = new byte[2048];
|
||||
int readCntOnce;
|
||||
try (InputStream inputStream = getInputStream(request)) {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
byte[] buffer = new byte[2048];
|
||||
int readCntOnce;
|
||||
|
||||
while ((readCntOnce = inputStream.read(buffer)) >= 0) {
|
||||
out.write(buffer, 0, readCntOnce);
|
||||
}
|
||||
while ((readCntOnce = inputStream.read(buffer)) >= 0) {
|
||||
out.write(buffer, 0, readCntOnce);
|
||||
}
|
||||
|
||||
List<Span> spanList = decoder.decodeList(out.toByteArray());
|
||||
List<Span> spanList = decoder.decodeList(out.toByteArray());
|
||||
|
||||
if (config.isNeedAnalysis()) {
|
||||
ZipkinSkyWalkingTransfer transfer = new ZipkinSkyWalkingTransfer();
|
||||
transfer.doTransfer(config, spanList);
|
||||
} else {
|
||||
SpanForward forward = new SpanForward(config, receiver);
|
||||
forward.send(spanList);
|
||||
if (config.isNeedAnalysis()) {
|
||||
ZipkinSkyWalkingTransfer transfer = new ZipkinSkyWalkingTransfer();
|
||||
transfer.doTransfer(config, spanList);
|
||||
} else {
|
||||
SpanForward forward = new SpanForward(config, receiver);
|
||||
forward.send(spanList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue