Skip to content

Commit

Permalink
clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
tbradellis committed Jun 29, 2022
1 parent 104212d commit 2711d81
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
26 changes: 18 additions & 8 deletions newrelic-agent/src/main/java/com/newrelic/agent/Agent.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@

import com.google.common.collect.ImmutableMap;
import com.newrelic.agent.bridge.AgentBridge;
import com.newrelic.agent.config.*;
import com.newrelic.agent.config.AgentJarHelper;
import com.newrelic.agent.config.ConfigService;
import com.newrelic.agent.config.ConfigServiceFactory;
import com.newrelic.agent.config.JarResource;
import com.newrelic.agent.config.JavaVersionUtils;
import com.newrelic.agent.core.CoreService;
import com.newrelic.agent.core.CoreServiceImpl;
import com.newrelic.agent.logging.AgentLogManager;
Expand All @@ -22,7 +26,6 @@
import com.newrelic.agent.util.asm.ClassStructure;
import com.newrelic.bootstrap.BootstrapLoader;
import com.newrelic.weave.utils.Streams;
import com.sun.org.apache.xpath.internal.operations.Bool;
import org.objectweb.asm.ClassReader;

import java.io.ByteArrayOutputStream;
Expand All @@ -32,9 +35,16 @@
import java.lang.instrument.Instrumentation;
import java.net.URL;
import java.text.MessageFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.jar.*;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.jar.Attributes;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.jar.JarOutputStream;
import java.util.jar.Manifest;
import java.util.logging.Level;
import java.util.regex.Pattern;

Expand Down Expand Up @@ -77,7 +87,6 @@ public static boolean isDebugEnabled() {
return DebugFlag.DEBUG;
}


private static volatile boolean canFastPath = true;

/**
Expand Down Expand Up @@ -312,7 +321,8 @@ public static long getAgentPremainTimeInMillis() {
private static void recordPremainTime(StatsService statsService, long startTime) {
agentPremainTime = System.currentTimeMillis() - startTime;
LOG.log(Level.INFO, "Premain startup complete in {0}ms", agentPremainTime);
statsService.doStatsWork(StatsWorks.getRecordResponseTimeWork(MetricNames.SUPPORTABILITY_TIMING_PREMAIN, agentPremainTime), MetricNames.SUPPORTABILITY_TIMING_PREMAIN);
statsService.doStatsWork(StatsWorks.getRecordResponseTimeWork(MetricNames.SUPPORTABILITY_TIMING_PREMAIN, agentPremainTime),
MetricNames.SUPPORTABILITY_TIMING_PREMAIN);

Map<String, Object> environmentInfo = ImmutableMap.<String, Object>builder()
.put("Duration", agentPremainTime)
Expand All @@ -338,7 +348,7 @@ private static void recordPremainTime(StatsService statsService, long startTime)
private static void recordAgentVersion(StatsService statsService) {
statsService.doStatsWork(
StatsWorks.getIncrementCounterWork(MessageFormat.format(MetricNames.SUPPORTABILITY_JAVA_AGENTVERSION, getVersion()), 1),
MetricNames.SUPPORTABILITY_JAVA_AGENTVERSION );
MetricNames.SUPPORTABILITY_JAVA_AGENTVERSION);
}

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

package com.newrelic.agent.config;

import com.newrelic.agent.Agent;
import com.newrelic.agent.DebugFlag;

import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

package com.newrelic.agent.config;

import com.newrelic.agent.Agent;
import com.newrelic.agent.DebugFlag;

import java.io.File;
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ include 'functional_test'
include 'functional_test:weave_test'
include 'functional_test:weave_test_impl'

JDK 9+ module system tests
// JDK 9+ module system tests
if (JavaVersion.current().isJava9Compatible()) {
include 'module_test_9'
}
Expand Down

0 comments on commit 2711d81

Please sign in to comment.