Fix thread leakage caused by es client connection creation (#6187)
This commit is contained in:
parent
d299ce0319
commit
9dcad4a0b4
|
|
@ -30,6 +30,8 @@ Release Notes.
|
|||
* The operation name of dubbo and dubbo-2.7.x-plugin, has been changed as the `groupValue/className.methodName` format
|
||||
* Fix bug that rocketmq-plugin set the wrong tag.
|
||||
* Fix duplicated `EnhancedInstance` interface added.
|
||||
* Fix thread leaks caused by the elasticsearch-6.x-plugin plugin.
|
||||
|
||||
|
||||
#### OAP-Backend
|
||||
* Make meter receiver support MAL.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,11 @@
|
|||
|
||||
package org.apache.skywalking.apm.plugin.elasticsearch.v6.interceptor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.skywalking.apm.agent.core.logging.api.ILog;
|
||||
import org.apache.skywalking.apm.agent.core.logging.api.LogManager;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor;
|
||||
import org.apache.skywalking.apm.plugin.elasticsearch.v6.RestClientEnhanceInfo;
|
||||
|
|
@ -27,6 +31,9 @@ import org.elasticsearch.client.RestClient;
|
|||
import org.elasticsearch.client.RestClientBuilder;
|
||||
|
||||
public class RestHighLevelClientConInterceptor implements InstanceConstructorInterceptor {
|
||||
|
||||
private static final ILog LOGGER = LogManager.getLogger(RestHighLevelClientConInterceptor.class);
|
||||
|
||||
@Override
|
||||
public void onConstruct(EnhancedInstance objInst, Object[] allArguments) {
|
||||
RestClientBuilder restClientBuilder = (RestClientBuilder) allArguments[0];
|
||||
|
|
@ -37,7 +44,11 @@ public class RestHighLevelClientConInterceptor implements InstanceConstructorInt
|
|||
for (Node node : nodeList) {
|
||||
restClientEnhanceInfo.addHttpHost(node.getHost());
|
||||
}
|
||||
|
||||
objInst.setSkyWalkingDynamicField(restClientEnhanceInfo);
|
||||
try {
|
||||
restClient.close();
|
||||
} catch (IOException e) {
|
||||
LOGGER.error("close restClient error , error message is " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue