Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#noissue] Cleanup #9612

Merged
merged 1 commit into from
Jan 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ public String toString() {
}
};

private Long maxFileSize;
private Boolean readOnly;
private Boolean compactionEnabled;
private Long memstoreFlushSize;
private Durability durability;
private final Long maxFileSize;
private final Boolean readOnly;
private final Boolean compactionEnabled;
private final Long memstoreFlushSize;
private final Durability durability;

public enum Durability {
ASYNC_WAL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public interface IdAllocator {
int allocate();

enum ID_TYPE {
BYPASS, ZIGZAG;
BYPASS, ZIGZAG
}

class ZigZagAllocator implements IdAllocator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,19 @@

package com.navercorp.pinpoint.profiler.instrument.interceptor;

import com.navercorp.pinpoint.bootstrap.interceptor.*;
import com.navercorp.pinpoint.bootstrap.interceptor.ApiIdAwareAroundInterceptor;
import com.navercorp.pinpoint.bootstrap.interceptor.AroundInterceptor;
import com.navercorp.pinpoint.bootstrap.interceptor.AroundInterceptor0;
import com.navercorp.pinpoint.bootstrap.interceptor.AroundInterceptor1;
import com.navercorp.pinpoint.bootstrap.interceptor.AroundInterceptor2;
import com.navercorp.pinpoint.bootstrap.interceptor.AroundInterceptor3;
import com.navercorp.pinpoint.bootstrap.interceptor.AroundInterceptor4;
import com.navercorp.pinpoint.bootstrap.interceptor.AroundInterceptor5;
import com.navercorp.pinpoint.bootstrap.interceptor.Interceptor;
import com.navercorp.pinpoint.bootstrap.interceptor.StaticAroundInterceptor;
import com.navercorp.pinpoint.bootstrap.interceptor.annotation.IgnoreMethod;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.lang.reflect.Method;
import java.util.ArrayList;
Expand Down Expand Up @@ -159,13 +168,13 @@ private InterceptorDefinition createInterceptorDefinition(Class<? extends Interc
final boolean afterIgnoreMethod = afterMethod.isAnnotationPresent(IgnoreMethod.class);


if (beforeIgnoreMethod == true && afterIgnoreMethod == true) {
if (beforeIgnoreMethod && afterIgnoreMethod) {
return new DefaultInterceptorDefinition(interceptorClazz, targetInterceptorClazz, interceptorType, CaptureType.NON, null, null);
}
if (beforeIgnoreMethod == true) {
if (beforeIgnoreMethod) {
return new DefaultInterceptorDefinition(interceptorClazz, targetInterceptorClazz, interceptorType, CaptureType.AFTER, null, afterMethod);
}
if (afterIgnoreMethod == true) {
if (afterIgnoreMethod) {
return new DefaultInterceptorDefinition(interceptorClazz, targetInterceptorClazz, interceptorType, CaptureType.BEFORE, beforeMethod, null);
}
return new DefaultInterceptorDefinition(interceptorClazz, targetInterceptorClazz, interceptorType, CaptureType.AROUND, beforeMethod, afterMethod);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,33 @@

package com.navercorp.pinpoint.profiler.instrument.lambda;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class LambdaClassJava15 implements LambdaClass {

public static final String DELEGATE_CLASS = "com/navercorp/pinpoint/bootstrap/java15/lambda/MethodHandlesLookupDelegatorJava15";

private final List<MethodInsn> methodInsnList;
private final MethodInsn methodInsn;

public LambdaClassJava15() {
this.methodInsnList = Arrays.asList(
new MethodInsn("generateInnerClass", "java/lang/invoke/MethodHandles$Lookup", "defineHiddenClass", DELEGATE_CLASS, "defineHiddenClass", "(Ljava/lang/invoke/MethodHandles$Lookup;[BZ[Ljava/lang/invoke/MethodHandles$Lookup$ClassOption;)Ljava/lang/invoke/MethodHandles$Lookup;"));
this.methodInsn = new MethodInsn("generateInnerClass",
"java/lang/invoke/MethodHandles$Lookup",
"defineHiddenClass",
DELEGATE_CLASS,
"defineHiddenClass",
"(Ljava/lang/invoke/MethodHandles$Lookup;[BZ[Ljava/lang/invoke/MethodHandles$Lookup$ClassOption;)Ljava/lang/invoke/MethodHandles$Lookup;");
}

@Override
public List<MethodInsn> getMethodInsnList() {
return methodInsnList;
return Collections.singletonList(methodInsn);
}

@Override
public String toString() {
return "LambdaClassJava15{" +
"methodInsnList=" + methodInsnList +
"methodInsn=" + methodInsn +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,33 @@ public class LambdaClassJava16 implements LambdaClass {

public static final String DELEGATE_CLASS = "com/navercorp/pinpoint/bootstrap/java16/lambda/MethodHandlesLookupDelegatorJava16";

private final List<MethodInsn> methodInsnList;
private final MethodInsn[] methodInsnList;

public LambdaClassJava16() {
this.methodInsnList = Arrays.asList(
new MethodInsn("generateInnerClass", "java/lang/invoke/MethodHandles$Lookup", "defineHiddenClass", DELEGATE_CLASS, "defineHiddenClass", "(Ljava/lang/invoke/MethodHandles$Lookup;[BZ[Ljava/lang/invoke/MethodHandles$Lookup$ClassOption;)Ljava/lang/invoke/MethodHandles$Lookup;"),
new MethodInsn("generateInnerClass", "java/lang/invoke/MethodHandles$Lookup", "defineHiddenClassWithClassData", DELEGATE_CLASS, "defineHiddenClassWithClassData", "(Ljava/lang/invoke/MethodHandles$Lookup;[BLjava/lang/Object;Z[Ljava/lang/invoke/MethodHandles$Lookup$ClassOption;)Ljava/lang/invoke/MethodHandles$Lookup;")
);
final MethodInsn insn1 = new MethodInsn("generateInnerClass",
"java/lang/invoke/MethodHandles$Lookup",
"defineHiddenClass",
DELEGATE_CLASS,
"defineHiddenClass",
"(Ljava/lang/invoke/MethodHandles$Lookup;[BZ[Ljava/lang/invoke/MethodHandles$Lookup$ClassOption;)Ljava/lang/invoke/MethodHandles$Lookup;");
final MethodInsn insn2 = new MethodInsn("generateInnerClass",
"java/lang/invoke/MethodHandles$Lookup",
"defineHiddenClassWithClassData",
DELEGATE_CLASS,
"defineHiddenClassWithClassData",
"(Ljava/lang/invoke/MethodHandles$Lookup;[BLjava/lang/Object;Z[Ljava/lang/invoke/MethodHandles$Lookup$ClassOption;)Ljava/lang/invoke/MethodHandles$Lookup;");
this.methodInsnList = new MethodInsn[]{insn1, insn2};
}

@Override
public List<MethodInsn> getMethodInsnList() {
return methodInsnList;
return Arrays.asList(methodInsnList);
}

@Override
public String toString() {
return "LambdaClassJava16{" +
"methodInsnList=" + methodInsnList +
"methodInsnList=" + Arrays.toString(methodInsnList) +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.navercorp.pinpoint.profiler.instrument.lambda;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
Expand All @@ -26,14 +26,20 @@ public class LambdaClassJava8 implements LambdaClass {

public static final String DELEGATE_CLASS = "com/navercorp/pinpoint/bootstrap/lambda/UnsafeDelegatorJava8";

private final List<MethodInsn> methodInsnList;
private final MethodInsn methodInsn;

public LambdaClassJava8() {
this.methodInsnList = Arrays.asList(new MethodInsn("spinInnerClass", "sun/misc/Unsafe", "defineAnonymousClass", DELEGATE_CLASS, "defineAnonymousClass", null));
this.methodInsn = new MethodInsn("spinInnerClass",
"sun/misc/Unsafe",
"defineAnonymousClass",
DELEGATE_CLASS,
"defineAnonymousClass",
null);

}

@Override
public List<MethodInsn> getMethodInsnList() {
return methodInsnList;
return Collections.singletonList(methodInsn);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.navercorp.pinpoint.profiler.instrument.lambda;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
Expand All @@ -26,14 +26,19 @@ public class LambdaClassJava9 implements LambdaClass {

public static final String DELEGATE_CLASS = "com/navercorp/pinpoint/bootstrap/java9/lambda/UnsafeDelegatorJava9";

private final List<MethodInsn> methodInsnList;
private final MethodInsn methodInsn;

public LambdaClassJava9() {
this.methodInsnList = Arrays.asList(new MethodInsn("spinInnerClass", "jdk/internal/misc/Unsafe", "defineAnonymousClass", DELEGATE_CLASS, "defineAnonymousClass", null));
this.methodInsn = new MethodInsn("spinInnerClass",
"jdk/internal/misc/Unsafe",
"defineAnonymousClass",
DELEGATE_CLASS,
"defineAnonymousClass",
null);
}

@Override
public List<MethodInsn> getMethodInsnList() {
return methodInsnList;
return Collections.singletonList(methodInsn);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
import java.util.Objects;

public class MethodInsn {
private String methodName;
private String targetClassName;
private String targetMethodName;
private String delegateClassName;
private String delegateMethodName;
private String delegateDescriptor;
private final String methodName;
private final String targetClassName;
private final String targetMethodName;
private final String delegateClassName;
private final String delegateMethodName;
private final String delegateDescriptor;

public MethodInsn(String methodName, String targetClassName, String targetMethodName, String delegateClassName, String delegateMethodName, String delegateDescriptor) {
this.methodName = Objects.requireNonNull(methodName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,49 +166,47 @@ public String convert(Object value) {
return "null";
}

if (Byte.class.isInstance(value)) {
if (value instanceof Byte) {
return simpleTypeConverter.convert(value);
} else if (Boolean.class.isInstance(value)) {
} else if (value instanceof Boolean) {
return simpleTypeConverter.convert(value);
} else if (Short.class.isInstance(value)) {
} else if (value instanceof Short) {
return simpleTypeConverter.convert(value);
} else if (Integer.class.isInstance(value)) {
} else if (value instanceof Integer) {
return simpleTypeConverter.convert(value);
} else if (Long.class.isInstance(value)) {
} else if (value instanceof Long) {
return simpleTypeConverter.convert(value);
} else if (Float.class.isInstance(value)) {
} else if (value instanceof Float) {
return simpleTypeConverter.convert(value);
} else if (Double.class.isInstance(value)) {
} else if (value instanceof Double) {
return simpleTypeConverter.convert(value);
} else if (BigDecimal.class.isInstance(value)) {
} else if (value instanceof BigDecimal) {
return simpleTypeConverter.convert(value);
} else if (String.class.isInstance(value)) {
} else if (value instanceof String) {
// String/NString
return simpleTypeConverter.convert(value);
} else if (Date.class.isInstance(value)) {
} else if (value instanceof Date) {
return simpleTypeConverter.convert(value);
} else if (Time.class.isInstance(value)) {
} else if (value instanceof Time) {
return simpleTypeConverter.convert(value);
} else if (Timestamp.class.isInstance(value)) {
} else if (value instanceof Timestamp) {
return simpleTypeConverter.convert(value);
} else if (URL.class.isInstance(value)) {
} else if (value instanceof URL) {
return simpleTypeConverter.convert(value);
} else if (Ref.class.isInstance(value)) {
} else if (value instanceof Ref) {
return simpleTypeConverter.convert(value);
} else if (InputStream.class.isInstance(value)) {
} else if (value instanceof InputStream) {
return classNameConverter.convert(value);
} else if (Reader.class.isInstance(value)) {
} else if (value instanceof Reader) {
return classNameConverter.convert(value);
} else if (Array.class.isInstance(value)) {
} else if (value instanceof Array) {
return classNameConverter.convert(value);
} else if (SQLXML.class.isInstance(value)) {
} else if (value instanceof SQLXML) {
return classNameConverter.convert(value);
} else if (byte[].class.isInstance(value)) {
} else if (value instanceof byte[]) {
return hexBytesConverter.convert(value);
} else if (Object.class.isInstance(value)) {
return objectConverter.convert(value);
}
return "";
return objectConverter.convert(value);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
package com.navercorp.pinpoint.profiler.sender;


import java.util.Objects;

import com.navercorp.pinpoint.common.util.Assert;
import com.navercorp.pinpoint.common.util.StringUtils;
import com.navercorp.pinpoint.io.request.Message;
Expand All @@ -36,15 +34,16 @@
import com.navercorp.pinpoint.thrift.io.HeaderTBaseDeserializer;
import com.navercorp.pinpoint.thrift.io.HeaderTBaseDeserializerFactory;
import com.navercorp.pinpoint.thrift.util.SerializationUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.thrift.TBase;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.util.HashedWheelTimer;
import org.jboss.netty.util.Timeout;
import org.jboss.netty.util.Timer;
import org.jboss.netty.util.TimerTask;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;

import java.util.Objects;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
Expand Down Expand Up @@ -81,7 +80,7 @@ public class TcpDataSender<T> implements EnhancedDataSender<T> {

public TcpDataSender(String name, String host, int port, PinpointClientFactory clientFactory) {
this(name, ClientFactoryUtils.newPinpointClientProvider(host, port, clientFactory),
(MessageSerializer<T, byte[]>) newDefaultMessageSerializer(), DEFAULT_QUEUE_SIZE);
newDefaultMessageSerializer(), DEFAULT_QUEUE_SIZE);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import com.google.protobuf.Empty;
import com.google.protobuf.GeneratedMessageV3;
import java.util.Objects;
import com.navercorp.pinpoint.grpc.client.ChannelFactory;
import com.navercorp.pinpoint.grpc.trace.PAgentStat;
import com.navercorp.pinpoint.grpc.trace.PAgentStatBatch;
Expand All @@ -35,6 +34,8 @@
import com.navercorp.pinpoint.profiler.util.NamedRunnable;
import io.grpc.stub.ClientCallStreamObserver;

import java.util.Objects;

import static com.navercorp.pinpoint.grpc.MessageFormatUtils.debugLog;

/**
Expand Down Expand Up @@ -101,7 +102,7 @@ public StatGrpcDataSender(String host, int port,
super(host, port, executorQueueSize, messageConverter, channelFactory);

this.reconnectExecutor = Objects.requireNonNull(reconnectExecutor, "reconnectExecutor");
final Runnable reconnectJob = new NamedRunnable(this.ID) {
final Runnable reconnectJob = new NamedRunnable(ID) {
@Override
public void run() {
startStream();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.navercorp.pinpoint.profiler.context;
package com.navercorp.pinpoint.profiler.context.id;

import com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder;
import com.navercorp.pinpoint.bootstrap.context.SpanRecorder;
import com.navercorp.pinpoint.bootstrap.context.Trace;
import com.navercorp.pinpoint.profiler.context.DisableAsyncChildTrace;
import com.navercorp.pinpoint.profiler.context.DisableTrace;
import com.navercorp.pinpoint.profiler.context.LocalAsyncId;
import com.navercorp.pinpoint.profiler.context.active.ActiveTraceHandle;
import com.navercorp.pinpoint.profiler.context.id.LocalTraceRoot;
import com.navercorp.pinpoint.profiler.context.id.TraceRoot;
import com.navercorp.pinpoint.profiler.context.storage.UriStatStorage;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
Expand Down