Merge pull request #75 from emeroad/remove_scope_api

remove scope object api
This commit is contained in:
Woonduk Kang
2015-01-06 15:46:26 +09:00
4 changed files with 13 additions and 34 deletions
@@ -35,12 +35,12 @@ public class AgentClassLoader {
private static final SecurityManager SECURITY_MANAGER = System.getSecurityManager();
private URLClassLoader classLoader;
private final URLClassLoader classLoader;
private String bootClass;
private Agent agentBootStrap;
private ContextClassLoaderExecuteTemplate<Object> executeTemplate;
private final ContextClassLoaderExecuteTemplate<Object> executeTemplate;
public AgentClassLoader(URL[] urls) {
if (urls == null) {
@@ -60,16 +60,8 @@ public interface InstrumentClass {
int addScopeInterceptor(String methodName, String[] args, Interceptor interceptor, String scopeName) throws InstrumentException, NotFoundInstrumentException;
int addScopeInterceptor(String methodName, String[] args, Interceptor interceptor, Scope scope) throws InstrumentException, NotFoundInstrumentException;
int addScopeInterceptorIfDeclared(String methodName, String[] args, Interceptor interceptor, String scopeName) throws InstrumentException;
/**
* Adds a scope interceptor to a method with matching methodName, and arguments.
* Note that the scope interceptor is added only if the method is actually implemented in the instrumented class.
*/
int addScopeInterceptorIfDeclared(String methodName, String[] args, Interceptor interceptor, Scope scope) throws InstrumentException;
int addInterceptor(String methodName, String[] args, Interceptor interceptor, Type type) throws InstrumentException, NotFoundInstrumentException;
void weaving(String adviceClassName) throws InstrumentException;
@@ -353,41 +353,34 @@ public class JavaAssistClass implements InstrumentClass {
@Override
public int addScopeInterceptor(String methodName, String[] args, Interceptor interceptor, String scopeName) throws InstrumentException, NotFoundInstrumentException {
final Scope scope = this.instrumentor.getScope(scopeName);
return addScopeInterceptor(methodName, args, interceptor, scope);
}
@Override
public int addScopeInterceptor(String methodName, String[] args, Interceptor interceptor, Scope scope) throws InstrumentException, NotFoundInstrumentException {
if (methodName == null) {
throw new NullPointerException("methodName must not be null");
}
if (interceptor == null) {
throw new IllegalArgumentException("interceptor is null");
}
if (scope == null) {
throw new NullPointerException("scope must not be null");
if (scopeName == null) {
throw new NullPointerException("scopeName must not be null");
}
final Scope scope = this.instrumentor.getScope(scopeName);
interceptor = wrapScopeInterceptor(interceptor, scope);
return addInterceptor(methodName, args, interceptor);
}
/*
* (non-Javadoc)
* @see com.navercorp.pinpoint.profiler.interceptor.bci.InstrumentClass#addScopeInterceptorIfDeclared(java.lang.String, java.lang.String[], com.navercorp.pinpoint.bootstrap.interceptor.Interceptor, com.navercorp.pinpoint.profiler.util.DepthScope)
*/
@Override
public int addScopeInterceptorIfDeclared(String methodName, String[] args, Interceptor interceptor, Scope scope) throws InstrumentException {
public int addScopeInterceptorIfDeclared(String methodName, String[] args, Interceptor interceptor, String scopeName) throws InstrumentException {
if (methodName == null) {
throw new NullPointerException("methodName must not be null");
}
if (interceptor == null) {
throw new IllegalArgumentException("interceptor is null");
}
if (scope == null) {
throw new NullPointerException("scope must not be null");
if (scopeName == null) {
throw new NullPointerException("scopeName must not be null");
}
final Scope scope = this.instrumentor.getScope(scopeName);
if (hasDeclaredMethod(methodName, args)) {
interceptor = wrapScopeInterceptor(interceptor, scope);
return addInterceptor(methodName, args, interceptor);
@@ -399,12 +392,6 @@ public class JavaAssistClass implements InstrumentClass {
}
}
@Override
public int addScopeInterceptorIfDeclared(String methodName, String[] args, Interceptor interceptor, String scopeName) throws InstrumentException {
final Scope scope = this.instrumentor.getScope(scopeName);
return addScopeInterceptorIfDeclared(methodName, args, interceptor, scope);
}
private Interceptor wrapScopeInterceptor(Interceptor interceptor, Scope scope) {
final Logger interceptorLogger = LoggerFactory.getLogger(interceptor.getClass());
@@ -22,5 +22,5 @@ import com.navercorp.pinpoint.profiler.util.DepthScope;
* @author Minwoo Jung
*/
public class HttpClient3Scope {
public static final DepthScope SCOPE = new DepthScope("HTTPClient3Scope");
public static final String SCOPE = "HTTPClient3Scope";
}