Skip to content

Commit

Permalink
[#noissue] Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
emeroad committed Feb 8, 2023
1 parent fba19ef commit cc892aa
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
public final class BootLogger {

private static final String FORMAT = "%tm-%<td %<tT.%<tL %-5s %-35.35s : %s";
private static final String LINE_SEPARATOR = System.getProperty("line.separator");
private static final String LINE_SEPARATOR = System.lineSeparator();

private static final BootLogLevel LOG_LEVEL = getLogLevel();
private final String loggerName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public final class ServerBootLogger {
private final PrintStream err = System.err;

private static final String LOGGER_FORMAT = "%-35.35s";
private static final String LINE_SEPARATOR = System.getProperty("line.separator");
private static final String LINE_SEPARATOR = System.lineSeparator();
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("MM-dd HH:mm:ss.SSS");

private ServerBootLogger(String loggerName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public void isInterceptable() throws Exception {
ClassNode classNode = TestClassLoader.get("com.navercorp.test.pinpoint.jdk8.interfaces.MethodInterface");
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
EngineComponent engineComponent = mock(EngineComponent.class);
ASMClass clazz = new ASMClass(engineComponent, pluginContext, classLoader, null, classNode);
ASMClass clazz = ASMClass.load(engineComponent, pluginContext, classLoader, null, classNode);
assertTrue(clazz.isInterceptable());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ private ProfilerConfig loadProfilerConfig(String configPath) {
}

public DefaultApplicationContext build(ProfilerConfig config) {
DefaultApplicationContext context = build(config, newModuleFactory());
return context;
return build(config, newModuleFactory());
}

public DefaultApplicationContext build(ProfilerConfig config, ModuleFactory moduleFactory) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ protected void configure() {

private ServerMetaDataRegistryService newServerMetaDataRegistryService() {
List<String> vmArgs = RuntimeMXBeanUtils.getVmArgs();
ServerMetaDataRegistryService serverMetaDataRegistryService = new DefaultServerMetaDataRegistryService(vmArgs);
return serverMetaDataRegistryService;
return new DefaultServerMetaDataRegistryService(vmArgs);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,8 @@
* @author Jongho Moon
*/
public class OrderedSpanRecorder implements ListenableDataSender.Listener<SpanType>, Iterable<SpanType> {
private static final String LINE_SEPARATOR = System.getProperty("line.separator");
private static final String LINE_SEPARATOR = System.lineSeparator();
public static final int ROOT_SEQUENCE = -1;
public static final int ASYNC_ID_NOT_SET = -1;
public static final int ASYNC_SEQUENCE_NOT_SET = -1;

private final List<Item<SpanType>> list = new ArrayList<>();

public OrderedSpanRecorder() {
Expand All @@ -63,7 +60,7 @@ private void insertSpan(Span span) {
long startTime = span.getStartTime();
TraceRoot traceRoot = span.getTraceRoot();

Item<SpanType> item = new Item<SpanType>(span, startTime, traceRoot, ROOT_SEQUENCE);
Item<SpanType> item = new Item<>(span, startTime, traceRoot, ROOT_SEQUENCE);
insertItem(item);
}

Expand All @@ -87,7 +84,7 @@ private void handleSpanEvent(SpanChunk spanChunk) {

final SpanEvent event = spanEventList.get(0);
long startTime = event.getStartTime();
Item<SpanType> item = new Item<SpanType>(spanChunk, startTime, spanChunk.getTraceRoot(), event.getSequence());
Item<SpanType> item = new Item<>(spanChunk, startTime, spanChunk.getTraceRoot(), event.getSequence());
insertItem(item);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected void configure() {

bind(StorageFactory.class).to(TestSpanStorageFactory.class);

bind(PinpointClientFactory.class).toProvider(Providers.of((PinpointClientFactory)null));
bind(PinpointClientFactory.class).toProvider(Providers.of(null));

EnhancedDataSender<MetaDataType> enhancedDataSender = newTcpDataSender();
logger.debug("enhancedDataSender:{}", enhancedDataSender);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ public class ASMClass implements InstrumentClass {
private boolean modified = false;
private String name;

public ASMClass(EngineComponent engineComponent, final InstrumentContext pluginContext, final ClassLoader classLoader, ProtectionDomain protectionDomain, final ClassNode classNode) {
this(engineComponent, pluginContext, new ASMClassNodeAdapter(pluginContext, classLoader, protectionDomain, classNode));
public static ASMClass load(EngineComponent engineComponent, final InstrumentContext pluginContext, final ClassLoader classLoader, ProtectionDomain protectionDomain, final ClassNode classNode) {
ASMClassNodeAdapter classNodeAdapter = new ASMClassNodeAdapter(pluginContext, classLoader, protectionDomain, classNode);
return new ASMClass(engineComponent, pluginContext, classNodeAdapter);
}

public ASMClass(EngineComponent engineComponent, final InstrumentContext pluginContext, final ASMClassNodeAdapter classNode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ public InstrumentClass getClass(InstrumentContext instrumentContext, ClassLoader
final ClassNode classNode = new ClassNode();
classReader.accept(classNode, 0);


return new ASMClass(engineComponent, instrumentContext, classLoader, protectionDomain, classNode);
return ASMClass.load(engineComponent, instrumentContext, classLoader, protectionDomain, classNode);
} catch (Exception e) {
throw new NotFoundInstrumentException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/
public class DeadlockMonitorTask implements Runnable {

private static final String LINE_SEPARATOR = System.getProperty("line.separator");
private static final String LINE_SEPARATOR = System.lineSeparator();

private final Logger logger = LogManager.getLogger(this.getClass());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,6 @@ public void isInterceptorable() throws Exception {
private ASMClass getClass(final String targetClassName) throws Exception {
ClassNode classNode = loader.get(targetClassName);
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
return new ASMClass(engineComponent, pluginContext, classLoader, getClass().getProtectionDomain(), classNode);
return ASMClass.load(engineComponent, pluginContext, classLoader, getClass().getProtectionDomain(), classNode);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ public Class<?> loadClass(String name) throws ClassNotFoundException {
try {
ClassNode classNode = loader.get(JavaAssistUtils.javaNameToJvmName(name));
EngineComponent engineComponent = mock(DefaultEngineComponent.class);
ASMClass asmClass = new ASMClass(engineComponent, null, null, null, classNode);

ASMClass asmClass = ASMClass.load(engineComponent, null, null, null, classNode);
if (asmClass.isInterceptable()) {
for (InstrumentMethod method : asmClass.getDeclaredMethods()) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public abstract class AbstractNetworkChecker implements NetworkChecker {

private static final String WHITE_SPACE = " "; // 4space
private static final String LINE_SEPARATOR = "\r\n";
private static final String LINE_SEPARATOR = System.lineSeparator();

private final String testName;

Expand Down Expand Up @@ -43,7 +43,7 @@ public void check() throws IOException {
report.append(createReport(ipAddress, check));
}

System.out.println(report.toString());
System.out.println(report);

}

Expand All @@ -59,12 +59,11 @@ public void check(byte[] requestData, byte[] expectedResponseData) throws IOExce
report.append(createReport(ipAddress, check));
}

System.out.println(report.toString());
System.out.println(report);
}

private String getHostName(InetSocketAddress hostAddress) {
String hostName = hostAddress.getHostName();
return hostName;
return hostAddress.getHostName();
}

private String createReport(InetSocketAddress socketAddress, boolean check) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*/
public final class ThreadDumpUtils {

public static final String LINE_SEPARATOR = System.getProperty("line.separator");
public static final String LINE_SEPARATOR = System.lineSeparator();
public static final String TAB_SEPARATOR = " "; // tab to 4 spaces

public static String createDumpMessage(TThreadDump threadDump) {
Expand Down

0 comments on commit cc892aa

Please # to comment.