Fix JdkObsolete issue (#5599)
* Fix JdkObsolete issue * Fix code style Co-authored-by: 吴晟 Wu Sheng <wu.sheng@foxmail.com>
This commit is contained in:
parent
8a8df3550e
commit
7c69ea889e
|
|
@ -25,12 +25,11 @@ import io.opentracing.Span;
|
|||
import io.opentracing.SpanContext;
|
||||
import io.opentracing.Tracer;
|
||||
import io.opentracing.tag.Tags;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SkywalkingSpanBuilder implements Tracer.SpanBuilder {
|
||||
private List<Tag> tags = new LinkedList<Tag>();
|
||||
private List<Tag> tags = new ArrayList<Tag>();
|
||||
private String operationName;
|
||||
private boolean isEntry = false;
|
||||
private boolean isExit = false;
|
||||
|
|
@ -83,9 +82,8 @@ public class SkywalkingSpanBuilder implements Tracer.SpanBuilder {
|
|||
isEntry = false;
|
||||
isExit = false;
|
||||
}
|
||||
} else if (Tags.PEER_HOST_IPV4.getKey().equals(key) || Tags.PEER_HOST_IPV6.getKey()
|
||||
.equals(key) || Tags.PEER_HOSTNAME.getKey()
|
||||
.equals(key)) {
|
||||
} else if (Tags.PEER_HOST_IPV4.getKey().equals(key) ||
|
||||
Tags.PEER_HOST_IPV6.getKey().equals(key) || Tags.PEER_HOSTNAME.getKey().equals(key)) {
|
||||
peer = value;
|
||||
} else if (Tags.PEER_SERVICE.getKey().equals(key)) {
|
||||
operationName = value;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,17 @@ package org.apache.skywalking.apm.plugin.feign.http.v9;
|
|||
|
||||
import feign.Request;
|
||||
import feign.Response;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.skywalking.apm.agent.core.context.CarrierItem;
|
||||
import org.apache.skywalking.apm.agent.core.context.ContextCarrier;
|
||||
import org.apache.skywalking.apm.agent.core.context.ContextManager;
|
||||
|
|
@ -31,17 +41,6 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedI
|
|||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
|
||||
import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.skywalking.apm.util.StringUtil;
|
||||
|
||||
import static feign.Util.valuesOrEmpty;
|
||||
|
|
@ -64,7 +63,7 @@ public class DefaultHttpClientInterceptor implements InstanceMethodsAroundInterc
|
|||
*/
|
||||
@Override
|
||||
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
|
||||
MethodInterceptResult result) throws Throwable {
|
||||
MethodInterceptResult result) throws Throwable {
|
||||
Request request = (Request) allArguments[0];
|
||||
URL url = new URL(request.url());
|
||||
ContextCarrier contextCarrier = new ContextCarrier();
|
||||
|
|
@ -113,7 +112,7 @@ public class DefaultHttpClientInterceptor implements InstanceMethodsAroundInterc
|
|||
CarrierItem next = contextCarrier.items();
|
||||
while (next.hasNext()) {
|
||||
next = next.next();
|
||||
List<String> contextCollection = new LinkedList<String>();
|
||||
List<String> contextCollection = new ArrayList<String>(1);
|
||||
contextCollection.add(next.getHeadValue());
|
||||
headers.put(next.getHeadKey(), contextCollection);
|
||||
}
|
||||
|
|
@ -143,7 +142,7 @@ public class DefaultHttpClientInterceptor implements InstanceMethodsAroundInterc
|
|||
*/
|
||||
@Override
|
||||
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
|
||||
Object ret) {
|
||||
Object ret) {
|
||||
Response response = (Response) ret;
|
||||
if (response != null) {
|
||||
int statusCode = response.status();
|
||||
|
|
@ -162,7 +161,7 @@ public class DefaultHttpClientInterceptor implements InstanceMethodsAroundInterc
|
|||
|
||||
@Override
|
||||
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
|
||||
Class<?>[] argumentsTypes, Throwable t) {
|
||||
Class<?>[] argumentsTypes, Throwable t) {
|
||||
AbstractSpan activeSpan = ContextManager.activeSpan();
|
||||
activeSpan.log(t);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@
|
|||
package org.apache.skywalking.apm.plugin.spring.mvc.commons.interceptor;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -219,7 +219,7 @@ public abstract class AbstractMethodInterceptor implements InstanceMethodsAround
|
|||
}
|
||||
|
||||
private void collectHttpHeaders(RequestHolder request, AbstractSpan span) {
|
||||
final List<String> headersList = new LinkedList<>();
|
||||
final List<String> headersList = new ArrayList<>(SpringMVCPluginConfig.Plugin.Http.INCLUDE_HTTP_HEADERS.size());
|
||||
SpringMVCPluginConfig.Plugin.Http.INCLUDE_HTTP_HEADERS.stream()
|
||||
.filter(
|
||||
headerName -> request.getHeaders(headerName) != null)
|
||||
|
|
|
|||
|
|
@ -19,13 +19,13 @@
|
|||
package org.apache.skywalking.apm.plugin.vertx3;
|
||||
|
||||
import io.vertx.core.impl.launcher.commands.VersionCommand;
|
||||
import java.util.Deque;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.LinkedBlockingDeque;
|
||||
import org.apache.skywalking.apm.agent.core.context.ContextSnapshot;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
class VertxContext {
|
||||
|
||||
public static final double VERTX_VERSION;
|
||||
|
|
@ -41,17 +41,17 @@ class VertxContext {
|
|||
}
|
||||
|
||||
public static final String STOP_SPAN_NECESSARY = "VERTX_STOP_SPAN_NECESSARY";
|
||||
private static final Map<String, Stack<VertxContext>> CONTEXT_MAP = new ConcurrentHashMap<>();
|
||||
private static final Map<String, Deque<VertxContext>> CONTEXT_MAP = new ConcurrentHashMap<>();
|
||||
|
||||
static void pushContext(String identifier, VertxContext vertxContext) {
|
||||
if (!CONTEXT_MAP.containsKey(identifier)) {
|
||||
CONTEXT_MAP.put(identifier, new Stack<>());
|
||||
CONTEXT_MAP.put(identifier, new LinkedBlockingDeque<>());
|
||||
}
|
||||
CONTEXT_MAP.get(identifier).push(vertxContext);
|
||||
}
|
||||
|
||||
static VertxContext popContext(String identifier) {
|
||||
final Stack<VertxContext> stack = CONTEXT_MAP.get(identifier);
|
||||
final Deque<VertxContext> stack = CONTEXT_MAP.get(identifier);
|
||||
final VertxContext context = stack.pop();
|
||||
if (stack.isEmpty()) {
|
||||
CONTEXT_MAP.remove(identifier);
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
package org.apache.skywalking.apm.agent.test.tools;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import org.apache.skywalking.apm.agent.core.boot.BootService;
|
||||
import org.apache.skywalking.apm.agent.core.boot.ServiceManager;
|
||||
import org.apache.skywalking.apm.agent.core.conf.Config;
|
||||
|
|
@ -40,9 +40,9 @@ public class AgentServiceRule extends ExternalResource {
|
|||
FieldSetter.setValue(
|
||||
ServiceManager.INSTANCE.getDeclaringClass(), "bootedServices", new HashMap<Class, BootService>());
|
||||
FieldSetter.setValue(
|
||||
IgnoredTracerContext.ListenerManager.class, "LISTENERS", new LinkedList<TracingContextListener>());
|
||||
IgnoredTracerContext.ListenerManager.class, "LISTENERS", new ArrayList<TracingContextListener>());
|
||||
FieldSetter.setValue(
|
||||
TracingContext.ListenerManager.class, "LISTENERS", new LinkedList<TracingContextListener>());
|
||||
TracingContext.ListenerManager.class, "LISTENERS", new ArrayList<TracingContextListener>());
|
||||
ServiceManager.INSTANCE.shutdown();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,18 +18,18 @@
|
|||
|
||||
package org.apache.skywalking.apm.agent.test.tools;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.skywalking.apm.agent.core.context.IgnoredTracerContext;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
|
||||
|
||||
public class SegmentStorage {
|
||||
private LinkedList<TraceSegment> traceSegments;
|
||||
private LinkedList<IgnoredTracerContext> ignoredTracerContexts;
|
||||
private List<TraceSegment> traceSegments;
|
||||
private List<IgnoredTracerContext> ignoredTracerContexts;
|
||||
|
||||
public SegmentStorage() {
|
||||
traceSegments = new LinkedList<TraceSegment>();
|
||||
ignoredTracerContexts = new LinkedList<IgnoredTracerContext>();
|
||||
traceSegments = new ArrayList<TraceSegment>();
|
||||
ignoredTracerContexts = new ArrayList<IgnoredTracerContext>();
|
||||
}
|
||||
|
||||
void addTraceSegment(TraceSegment segment) {
|
||||
|
|
@ -44,7 +44,7 @@ public class SegmentStorage {
|
|||
this.ignoredTracerContexts.add(context);
|
||||
}
|
||||
|
||||
public LinkedList<IgnoredTracerContext> getIgnoredTracerContexts() {
|
||||
public List<IgnoredTracerContext> getIgnoredTracerContexts() {
|
||||
return ignoredTracerContexts;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue