diff --git a/bootstraps/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/plugin/test/ExpectedSql.java b/bootstraps/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/plugin/test/ExpectedSql.java index 3a3eeaa34a2e..c207218d866a 100644 --- a/bootstraps/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/plugin/test/ExpectedSql.java +++ b/bootstraps/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/plugin/test/ExpectedSql.java @@ -15,9 +15,9 @@ package com.navercorp.pinpoint.bootstrap.plugin.test; import java.util.Arrays; +import java.util.StringJoiner; import com.navercorp.pinpoint.common.trace.AnnotationKey; -import com.navercorp.pinpoint.common.util.StringJoiner; /** * @author Jongho Moon diff --git a/commons/src/main/java/com/navercorp/pinpoint/common/util/StringJoinUtils.java b/commons/src/main/java/com/navercorp/pinpoint/common/util/StringJoinUtils.java index 7dc0d001e912..2dd72fdecaea 100644 --- a/commons/src/main/java/com/navercorp/pinpoint/common/util/StringJoinUtils.java +++ b/commons/src/main/java/com/navercorp/pinpoint/common/util/StringJoinUtils.java @@ -4,6 +4,7 @@ import java.util.ConcurrentModificationException; import java.util.Iterator; import java.util.Objects; +import java.util.StringJoiner; public class StringJoinUtils { private StringJoinUtils() { @@ -22,11 +23,11 @@ public static String join(final Collection collection, final String if (size == 1) { return getFirstElement(collection); } - - final int bufferSize = StringJoiner.getBufferSize(collection, delimiter); - final StringBuilder buffer = new StringBuilder(bufferSize); - StringJoiner.build(buffer, collection, delimiter); - return buffer.toString(); + StringJoiner joiner = new StringJoiner(delimiter); + for (String str : collection) { + joiner.add(str); + } + return joiner.toString(); } private static String getFirstElement(Collection collection) { diff --git a/commons/src/main/java/com/navercorp/pinpoint/common/util/StringJoiner.java b/commons/src/main/java/com/navercorp/pinpoint/common/util/StringJoiner.java deleted file mode 100644 index 92cf5d89b9bc..000000000000 --- a/commons/src/main/java/com/navercorp/pinpoint/common/util/StringJoiner.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.navercorp.pinpoint.common.util; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Objects; - -public class StringJoiner { - private final String delimiter; - private final List list = new ArrayList<>(); - - public StringJoiner(String delimiter) { - this.delimiter = Objects.requireNonNull(delimiter, "delimiter"); - } - - public void add(String str) { - this.list.add(str); - } - - public String toString() { - int bufferSize = getBufferSize(list, delimiter); - - StringBuilder buffer = new StringBuilder(bufferSize); - build(buffer, list, delimiter); - return buffer.toString(); - } - - static void build(StringBuilder buffer, Collection list, String separator) { - boolean first = true; - for (String str : list) { - if (first) { - first = false; - } else { - buffer.append(separator); - } - buffer.append(str); - } - } - - static int getBufferSize(Collection list, String separator) { - final int length = separator.length(); - - int bufferSize = 0; - boolean first = true; - for (String str : list) { - if (first) { - first = false; - } else { - bufferSize += length; - } - // null == "null" - bufferSize += StringUtils.getLength(str, 4); - } - return bufferSize; - } -} diff --git a/commons/src/test/java/com/navercorp/pinpoint/common/util/ArrayUtilsTest.java b/commons/src/test/java/com/navercorp/pinpoint/common/util/ArrayUtilsTest.java index c7f6456b5b0e..c3f83d6fe4e1 100644 --- a/commons/src/test/java/com/navercorp/pinpoint/common/util/ArrayUtilsTest.java +++ b/commons/src/test/java/com/navercorp/pinpoint/common/util/ArrayUtilsTest.java @@ -23,6 +23,7 @@ import org.apache.logging.log4j.LogManager; import java.util.Arrays; +import java.util.StringJoiner; /** * @author Woonduk Kang(emeroad) diff --git a/grpc/src/main/java/com/navercorp/pinpoint/grpc/client/SupportCommandCodeClientInterceptor.java b/grpc/src/main/java/com/navercorp/pinpoint/grpc/client/SupportCommandCodeClientInterceptor.java index c41ae6168537..00f6c0f375cd 100644 --- a/grpc/src/main/java/com/navercorp/pinpoint/grpc/client/SupportCommandCodeClientInterceptor.java +++ b/grpc/src/main/java/com/navercorp/pinpoint/grpc/client/SupportCommandCodeClientInterceptor.java @@ -16,7 +16,6 @@ package com.navercorp.pinpoint.grpc.client; -import com.navercorp.pinpoint.common.util.StringJoiner; import com.navercorp.pinpoint.grpc.Header; import io.grpc.CallOptions; import io.grpc.Channel; @@ -29,6 +28,7 @@ import java.util.Collection; import java.util.Objects; import java.util.Set; +import java.util.StringJoiner; public class SupportCommandCodeClientInterceptor implements ClientInterceptor { diff --git a/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/provider/stat/buffer/BufferMetricProvider.java b/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/provider/stat/buffer/BufferMetricProvider.java index 6426cb5c268d..3697861a1e49 100644 --- a/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/provider/stat/buffer/BufferMetricProvider.java +++ b/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/provider/stat/buffer/BufferMetricProvider.java @@ -18,8 +18,6 @@ import com.google.inject.Inject; import com.google.inject.Provider; -import com.navercorp.pinpoint.common.util.JvmUtils; -import com.navercorp.pinpoint.common.util.JvmVersion; import com.navercorp.pinpoint.profiler.monitor.metric.buffer.BufferMetric; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; @@ -41,13 +39,6 @@ public BufferMetricProvider() { @Override public BufferMetric get() { - - final JvmVersion jvmVersion = JvmUtils.getVersion(); - if (!jvmVersion.onOrAfter(JvmVersion.JAVA_7)) { - logger.debug("Unsupported JVM version. {}", jvmVersion); - return BufferMetric.UNSUPPORTED_BUFFER_METRIC; - } - BufferMetric bufferMetric = createBufferMetric(BUFFER_METRIC); logger.info("loaded : {}", bufferMetric); return bufferMetric; diff --git a/test/src/main/java/com/navercorp/pinpoint/test/plugin/AbstractPinpointPluginTestSuite.java b/test/src/main/java/com/navercorp/pinpoint/test/plugin/AbstractPinpointPluginTestSuite.java index c3874b5197d7..7a73a706c114 100644 --- a/test/src/main/java/com/navercorp/pinpoint/test/plugin/AbstractPinpointPluginTestSuite.java +++ b/test/src/main/java/com/navercorp/pinpoint/test/plugin/AbstractPinpointPluginTestSuite.java @@ -19,7 +19,6 @@ import com.navercorp.pinpoint.test.plugin.util.ArrayUtils; import com.navercorp.pinpoint.test.plugin.util.CodeSourceUtils; import com.navercorp.pinpoint.test.plugin.util.StringUtils; -import com.navercorp.pinpoint.test.plugin.util.TLSOption; import com.navercorp.pinpoint.test.plugin.util.TestLogger; import com.navercorp.pinpoint.test.plugin.util.TestPluginVersion; @@ -67,7 +66,6 @@ public abstract class AbstractPinpointPluginTestSuite extends Suite { public AbstractPinpointPluginTestSuite(Class testClass) throws InitializationError { super(testClass, Collections.emptyList()); - TLSOption.applyTLSv12(); PinpointAgent agent = testClass.getAnnotation(PinpointAgent.class); this.agentJar = resolveAgentPath(agent); diff --git a/test/src/main/java/com/navercorp/pinpoint/test/plugin/MavenCentral.java b/test/src/main/java/com/navercorp/pinpoint/test/plugin/MavenCentral.java index 269b463c9021..54b63eb2d215 100644 --- a/test/src/main/java/com/navercorp/pinpoint/test/plugin/MavenCentral.java +++ b/test/src/main/java/com/navercorp/pinpoint/test/plugin/MavenCentral.java @@ -16,42 +16,16 @@ package com.navercorp.pinpoint.test.plugin; -import com.navercorp.pinpoint.test.plugin.util.JDKUtils; - /** * @author Woonduk Kang(emeroad) */ public final class MavenCentral { public static final String MAVEN_CENTRAL_SECURE = "https://repo.maven.apache.org/maven2"; - /* - * for jdk 6, 7 - * Central 501 HTTPS Required - * https://support.sonatype.com/hc/en-us/articles/360041287334 - * Discontinued support for TLSv1.1 and below - * https://central.sonatype.org/articles/2018/May/04/discontinued-support-for-tlsv11-and-below/ - * */ - public static final String MAVEN_CENTRAL_INSECURE = "http://insecure.repo1.maven.org/maven2/"; - - public static final String INSECURE_ENABLE = "pinpoint.plugin.maven.insecure.enable"; - private MavenCentral() { } public static String getAddress() { - if (enableMavenInsecure()) { - if (JDKUtils.isJdk8Plus()) { - return MAVEN_CENTRAL_SECURE; - } else { - return MAVEN_CENTRAL_INSECURE; - } - } return MAVEN_CENTRAL_SECURE; - - } - - private static boolean enableMavenInsecure() { - String mavenInsecureEnable = System.getProperty(INSECURE_ENABLE, Boolean.FALSE.toString()); - return mavenInsecureEnable.equals(Boolean.TRUE.toString()); } } diff --git a/test/src/main/java/com/navercorp/pinpoint/test/plugin/shared/SharedProcessManager.java b/test/src/main/java/com/navercorp/pinpoint/test/plugin/shared/SharedProcessManager.java index c59a9bd18e75..32364c1863ef 100644 --- a/test/src/main/java/com/navercorp/pinpoint/test/plugin/shared/SharedProcessManager.java +++ b/test/src/main/java/com/navercorp/pinpoint/test/plugin/shared/SharedProcessManager.java @@ -23,10 +23,7 @@ import com.navercorp.pinpoint.test.plugin.ProcessManager; import com.navercorp.pinpoint.test.plugin.util.CollectionUtils; import com.navercorp.pinpoint.test.plugin.util.CommandLineOption; -import com.navercorp.pinpoint.test.plugin.util.JDKUtils; -import com.navercorp.pinpoint.test.plugin.util.StringJoiner; import com.navercorp.pinpoint.test.plugin.util.StringUtils; -import com.navercorp.pinpoint.test.plugin.util.TLSOption; import com.navercorp.pinpoint.test.plugin.util.TestLogger; import org.eclipse.aether.artifact.Artifact; import org.tinylog.TaggedLogger; @@ -39,6 +36,7 @@ import java.util.Map; import java.util.Objects; import java.util.Set; +import java.util.StringJoiner; import java.util.Timer; import java.util.TimerTask; @@ -58,7 +56,6 @@ public class SharedProcessManager implements ProcessManager { public SharedProcessManager(PluginTestContext context) { this.context = Objects.requireNonNull(context, "context"); - TLSOption.applyTLSv12(); } @Override @@ -152,12 +149,6 @@ private List buildCommand() { option.addOption("-Xmx1024m"); final List jvmArguments = context.getJvmArguments(); - if (!JDKUtils.isJdk8Plus()) { - // -XX:MaxPermSize for jdk 7 - if (!hasMaxPermSize(jvmArguments)) { - option.addOption("-XX:MaxPermSize=512m"); - } - } option.addOptions(jvmArguments); diff --git a/test/src/main/java/com/navercorp/pinpoint/test/plugin/util/JDKUtils.java b/test/src/main/java/com/navercorp/pinpoint/test/plugin/util/JDKUtils.java deleted file mode 100644 index 2247d0e733d6..000000000000 --- a/test/src/main/java/com/navercorp/pinpoint/test/plugin/util/JDKUtils.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.navercorp.pinpoint.test.plugin.util; - -public class JDKUtils { - - private static final boolean JDK8_PLUS = getJDK8Plus(); - - private static boolean getJDK8Plus() { - try { - Class.forName("java.util.Optional"); - return true; - } catch (ClassNotFoundException e) { - return false; - } - } - - public static boolean isJdk8Plus() { - return JDK8_PLUS; - } -} diff --git a/test/src/main/java/com/navercorp/pinpoint/test/plugin/util/StringJoiner.java b/test/src/main/java/com/navercorp/pinpoint/test/plugin/util/StringJoiner.java deleted file mode 100644 index be8239fac6be..000000000000 --- a/test/src/main/java/com/navercorp/pinpoint/test/plugin/util/StringJoiner.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.navercorp.pinpoint.test.plugin.util; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Objects; - -/** - * copy com.navercorp.pinpoint.common.util.StringJoiner - */ -public class StringJoiner { - private final String delimiter; - private final List list = new ArrayList<>(); - - public StringJoiner(String delimiter) { - this.delimiter = Objects.requireNonNull(delimiter, "delimiter"); - } - - public void add(String str) { - this.list.add(str); - } - - public String toString() { - int bufferSize = getBufferSize(list, delimiter); - - StringBuilder buffer = new StringBuilder(bufferSize); - build(buffer, list, delimiter); - return buffer.toString(); - } - - static void build(StringBuilder buffer, Collection list, String separator) { - boolean first = true; - for (String str : list) { - if (first) { - first = false; - } else { - buffer.append(separator); - } - buffer.append(str); - } - } - - static int getBufferSize(Collection list, String separator) { - final int length = separator.length(); - - int bufferSize = 0; - boolean first = true; - for (String str : list) { - if (first) { - first = false; - } else { - bufferSize += length; - } - // null == "null" - bufferSize += StringUtils.getLength(str, 4); - } - return bufferSize; - } -} diff --git a/test/src/main/java/com/navercorp/pinpoint/test/plugin/util/StringUtils.java b/test/src/main/java/com/navercorp/pinpoint/test/plugin/util/StringUtils.java index f56292cd4451..87d6d3be5d94 100644 --- a/test/src/main/java/com/navercorp/pinpoint/test/plugin/util/StringUtils.java +++ b/test/src/main/java/com/navercorp/pinpoint/test/plugin/util/StringUtils.java @@ -1,6 +1,7 @@ package com.navercorp.pinpoint.test.plugin.util; import java.util.Collection; +import java.util.StringJoiner; public final class StringUtils { private StringUtils() { diff --git a/test/src/main/java/com/navercorp/pinpoint/test/plugin/util/TLSOption.java b/test/src/main/java/com/navercorp/pinpoint/test/plugin/util/TLSOption.java deleted file mode 100644 index 84bf486ce798..000000000000 --- a/test/src/main/java/com/navercorp/pinpoint/test/plugin/util/TLSOption.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.navercorp.pinpoint.test.plugin.util; - -public final class TLSOption { - public static final String TLS_KEY = "https.protocols"; - - private TLSOption() { - } - - public static void applyTLSv12() { - if (JDKUtils.isJdk8Plus()) { - return; - } - - System.setProperty(TLS_KEY, "SSLv3,TLSv1,TLSv1.1,TLSv1.2"); - } -}