Skip to content

Commit

Permalink
Remove confuse abstract method
Browse files Browse the repository at this point in the history
  • Loading branch information
ascrutae committed Oct 26, 2017
1 parent 0d64062 commit f67be17
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
Expand Up @@ -23,11 +23,9 @@
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;
Expand Down Expand Up @@ -139,10 +137,4 @@ public abstract class AbstractConnectionInstrumentation extends ClassInstanceMet
}
};
}

@Override protected ClassMatch enhanceClass() {
return byName(getEnhanceClass());
}

public abstract String getEnhanceClass();
}
Expand Up @@ -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}.
*
Expand All @@ -26,7 +30,7 @@
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);
}
}
Expand Up @@ -21,8 +21,10 @@
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}.
Expand All @@ -48,7 +50,7 @@ public class JdbcXAConnectionInstrumentation extends AbstractConnectionInstrumen
};
}

@Override public String getEnhanceClass() {
return ENHANCE_CLASS;
@Override protected ClassMatch enhanceClass() {
return byName(ENHANCE_CLASS);
}
}
Expand Up @@ -21,11 +21,14 @@
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
*/
Expand All @@ -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<MethodDescription> getConstructorMatcher() {
return any();
Expand All @@ -48,7 +51,7 @@ public class PooledJdbcConnectionInstrumentation extends AbstractConnectionInstr
};
}

@Override public String getEnhanceClass() {
return ENHANCE_CLASS;
@Override protected ClassMatch enhanceClass() {
return byName(ENHANCE_CLASS);
}
}

0 comments on commit f67be17

Please sign in to comment.