From f67be17d4c30733e353f64e4342f07b9aae9a951 Mon Sep 17 00:00:00 2001 From: ascrutae Date: Thu, 26 Oct 2017 15:28:00 +0800 Subject: [PATCH] Remove confuse abstract method --- .../h2/define/AbstractConnectionInstrumentation.java | 8 -------- .../jdbc/h2/define/JdbcConnectionInstrumentation.java | 8 ++++++-- .../h2/define/JdbcXAConnectionInstrumentation.java | 6 ++++-- .../define/PooledJdbcConnectionInstrumentation.java | 11 +++++++---- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/apm-sniffer/apm-sdk-plugin/h2-1.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/h2/define/AbstractConnectionInstrumentation.java b/apm-sniffer/apm-sdk-plugin/h2-1.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/h2/define/AbstractConnectionInstrumentation.java index 640252b38..b7fc337e3 100644 --- a/apm-sniffer/apm-sdk-plugin/h2-1.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/h2/define/AbstractConnectionInstrumentation.java +++ b/apm-sniffer/apm-sdk-plugin/h2-1.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/h2/define/AbstractConnectionInstrumentation.java @@ -23,11 +23,9 @@ import net.bytebuddy.matcher.ElementMatcher; import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint; import org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint; import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine; -import org.skywalking.apm.agent.core.plugin.match.ClassMatch; import static net.bytebuddy.matcher.ElementMatchers.named; import static net.bytebuddy.matcher.ElementMatchers.takesArguments; -import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName; import static org.skywalking.apm.plugin.jdbc.define.Constants.CLOSE_METHOD_NAME; import static org.skywalking.apm.plugin.jdbc.define.Constants.COMMIT_METHOD_NAME; import static org.skywalking.apm.plugin.jdbc.define.Constants.CREATE_STATEMENT_INTERCEPT_CLASS; @@ -139,10 +137,4 @@ public abstract class AbstractConnectionInstrumentation extends ClassInstanceMet } }; } - - @Override protected ClassMatch enhanceClass() { - return byName(getEnhanceClass()); - } - - public abstract String getEnhanceClass(); } diff --git a/apm-sniffer/apm-sdk-plugin/h2-1.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/h2/define/JdbcConnectionInstrumentation.java b/apm-sniffer/apm-sdk-plugin/h2-1.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/h2/define/JdbcConnectionInstrumentation.java index ae74b90f7..0c445bdda 100644 --- a/apm-sniffer/apm-sdk-plugin/h2-1.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/h2/define/JdbcConnectionInstrumentation.java +++ b/apm-sniffer/apm-sdk-plugin/h2-1.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/h2/define/JdbcConnectionInstrumentation.java @@ -18,6 +18,10 @@ package org.skywalking.apm.plugin.jdbc.h2.define; +import org.skywalking.apm.agent.core.plugin.match.ClassMatch; + +import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName; + /** * {@link JdbcConnectionInstrumentation} presents that skywalking intercepts {@link org.h2.jdbc.JdbcConnection}. * @@ -26,7 +30,7 @@ package org.skywalking.apm.plugin.jdbc.h2.define; public class JdbcConnectionInstrumentation extends AbstractConnectionInstrumentation { public static final String ENHANCE_CLASS = "org.h2.jdbc.JdbcConnection"; - @Override public String getEnhanceClass() { - return ENHANCE_CLASS; + @Override protected ClassMatch enhanceClass() { + return byName(ENHANCE_CLASS); } } diff --git a/apm-sniffer/apm-sdk-plugin/h2-1.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/h2/define/JdbcXAConnectionInstrumentation.java b/apm-sniffer/apm-sdk-plugin/h2-1.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/h2/define/JdbcXAConnectionInstrumentation.java index 7c575bad5..36c58b16a 100644 --- a/apm-sniffer/apm-sdk-plugin/h2-1.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/h2/define/JdbcXAConnectionInstrumentation.java +++ b/apm-sniffer/apm-sdk-plugin/h2-1.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/h2/define/JdbcXAConnectionInstrumentation.java @@ -21,8 +21,10 @@ package org.skywalking.apm.plugin.jdbc.h2.define; import net.bytebuddy.description.method.MethodDescription; import net.bytebuddy.matcher.ElementMatcher; import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint; +import org.skywalking.apm.agent.core.plugin.match.ClassMatch; import static net.bytebuddy.matcher.ElementMatchers.any; +import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName; /** * {@link JdbcXAConnectionInstrumentation} presents that skywalking intercepts {@link org.h2.jdbcx.JdbcXAConnection}. @@ -48,7 +50,7 @@ public class JdbcXAConnectionInstrumentation extends AbstractConnectionInstrumen }; } - @Override public String getEnhanceClass() { - return ENHANCE_CLASS; + @Override protected ClassMatch enhanceClass() { + return byName(ENHANCE_CLASS); } } diff --git a/apm-sniffer/apm-sdk-plugin/h2-1.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/h2/define/PooledJdbcConnectionInstrumentation.java b/apm-sniffer/apm-sdk-plugin/h2-1.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/h2/define/PooledJdbcConnectionInstrumentation.java index cc34a4d4c..72a0d14f6 100644 --- a/apm-sniffer/apm-sdk-plugin/h2-1.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/h2/define/PooledJdbcConnectionInstrumentation.java +++ b/apm-sniffer/apm-sdk-plugin/h2-1.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/h2/define/PooledJdbcConnectionInstrumentation.java @@ -21,11 +21,14 @@ package org.skywalking.apm.plugin.jdbc.h2.define; import net.bytebuddy.description.method.MethodDescription; import net.bytebuddy.matcher.ElementMatcher; import org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint; +import org.skywalking.apm.agent.core.plugin.match.ClassMatch; import static net.bytebuddy.matcher.ElementMatchers.any; +import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName; /** - * {@link PooledJdbcConnectionInstrumentation} presents that skywalking intercepts {@link org.h2.jdbcx.JdbcXAConnection}. + * {@link PooledJdbcConnectionInstrumentation} presents that skywalking intercepts {@link + * org.h2.jdbcx.JdbcXAConnection}. * * @author zhangxin */ @@ -35,7 +38,7 @@ public class PooledJdbcConnectionInstrumentation extends AbstractConnectionInstr public static final String ENHANCE_CLASS = "org.h2.jdbcx.JdbcXAConnection$PooledJdbcConnection"; @Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() { - return new ConstructorInterceptPoint[]{ + return new ConstructorInterceptPoint[] { new ConstructorInterceptPoint() { @Override public ElementMatcher getConstructorMatcher() { return any(); @@ -48,7 +51,7 @@ public class PooledJdbcConnectionInstrumentation extends AbstractConnectionInstr }; } - @Override public String getEnhanceClass() { - return ENHANCE_CLASS; + @Override protected ClassMatch enhanceClass() { + return byName(ENHANCE_CLASS); } }