16
16
17
17
package cn .polarismesh .agent .pinpoint .dubbox ;
18
18
19
- import cn .polarismesh .agent .pinpoint .dubbox .Interceptor .DubboClusterInvokerInterceptor ;
20
- import cn .polarismesh .agent .pinpoint .dubbox .Interceptor .DubboExporterInterceptor ;
21
- import cn .polarismesh .agent .pinpoint .dubbox .Interceptor .DubboInvokeInterceptor ;
22
- import cn .polarismesh .agent .pinpoint .dubbox .Interceptor .DubboInvokerInterceptor ;
23
- import cn .polarismesh .agent .pinpoint .dubbox .Interceptor .DubboRegistryInterceptor ;
24
- import cn .polarismesh .agent .pinpoint .dubbox .Interceptor .DubboUrlInterceptor ;
19
+ import cn .polarismesh .agent .pinpoint .dubbox .Interceptor .*;
20
+ import com .alibaba .dubbo .common .URL ;
21
+ import com .alibaba .dubbo .registry .RegistryFactory ;
22
+ import com .alibaba .dubbo .registry .integration .RegistryProtocol ;
23
+ import com .alibaba .dubbo .rpc .Invocation ;
24
+ import com .alibaba .dubbo .rpc .Invoker ;
25
+ import com .alibaba .dubbo .rpc .cluster .Directory ;
26
+ import com .alibaba .dubbo .rpc .cluster .support .AbstractClusterInvoker ;
27
+ import com .alibaba .dubbo .rpc .protocol .AbstractExporter ;
28
+ import com .alibaba .dubbo .rpc .protocol .AbstractProxyProtocol ;
29
+ import com .alibaba .dubbo .rpc .protocol .dubbo .DubboProtocol ;
30
+ import com .alibaba .dubbo .rpc .protocol .injvm .InjvmProtocol ;
31
+ import com .alibaba .dubbo .rpc .protocol .memcached .MemcachedProtocol ;
32
+ import com .alibaba .dubbo .rpc .protocol .redis .RedisProtocol ;
33
+ import com .alibaba .dubbo .rpc .protocol .thrift .ThriftProtocol ;
25
34
import com .navercorp .pinpoint .bootstrap .instrument .InstrumentClass ;
26
35
import com .navercorp .pinpoint .bootstrap .instrument .InstrumentException ;
27
36
import com .navercorp .pinpoint .bootstrap .instrument .InstrumentMethod ;
31
40
import com .navercorp .pinpoint .bootstrap .instrument .transformer .TransformTemplateAware ;
32
41
import com .navercorp .pinpoint .bootstrap .plugin .ProfilerPlugin ;
33
42
import com .navercorp .pinpoint .bootstrap .plugin .ProfilerPluginSetupContext ;
43
+
34
44
import java .security .ProtectionDomain ;
35
45
import java .util .Map ;
36
46
@@ -59,9 +69,9 @@ private void addTransformers() {
59
69
transformTemplate .transform ("com.alibaba.dubbo.rpc.protocol.thrift.ThriftProtocol" , ProtocolTransform .class );
60
70
61
71
transformTemplate .transform ("com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker" ,
62
- AbstractClusterInvokerTransform .class );
72
+ ClusterInvokerTransform .class );
63
73
64
- transformTemplate .transform ("com.alibaba.dubbo.rpc.protocol.AbstractExporter" , AbstractExporterTransform .class );
74
+ transformTemplate .transform ("com.alibaba.dubbo.rpc.protocol.AbstractExporter" , ExporterTransform .class );
65
75
66
76
transformTemplate .transform ("com.alibaba.dubbo.common.URL" , UrlConstructorTransform .class );
67
77
}
@@ -74,7 +84,7 @@ public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, Strin
74
84
throws InstrumentException {
75
85
final InstrumentClass target = instrumentor .getInstrumentClass (loader , className , classfileBuffer );
76
86
InstrumentMethod invokeMethod = target
77
- .getDeclaredMethod ("setRegistryFactory" , "com.alibaba.dubbo.registry.RegistryFactory" );
87
+ .getDeclaredMethod ("setRegistryFactory" , RegistryFactory . class . getCanonicalName () );
78
88
if (invokeMethod != null ) {
79
89
invokeMethod .addInterceptor (DubboRegistryInterceptor .class );
80
90
}
@@ -90,42 +100,42 @@ public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, Strin
90
100
throws InstrumentException {
91
101
final InstrumentClass target = instrumentor .getInstrumentClass (loader , className , classfileBuffer );
92
102
InstrumentMethod invokeMethod = target
93
- .getDeclaredMethod ("refer" , "java.lang.Class" , "com.alibaba.dubbo.common.URL" );
103
+ .getDeclaredMethod ("refer" , Class . class . getCanonicalName (), URL . class . getCanonicalName () );
94
104
if (invokeMethod != null ) {
95
105
invokeMethod .addInterceptor (DubboInvokerInterceptor .class );
96
106
}
97
107
return target .toBytecode ();
98
108
}
99
109
}
100
110
101
- public static class AbstractClusterInvokerTransform implements TransformCallback {
111
+ public static class ClusterInvokerTransform implements TransformCallback {
102
112
103
113
@ Override
104
114
public byte [] doInTransform (Instrumentor instrumentor , ClassLoader loader , String className ,
105
115
Class <?> classBeingRedefined , ProtectionDomain protectionDomain , byte [] classfileBuffer )
106
116
throws InstrumentException {
107
117
final InstrumentClass target = instrumentor .getInstrumentClass (loader , className , classfileBuffer );
108
118
InstrumentMethod constructor = target
109
- .getConstructor ("com.alibaba.dubbo.rpc.cluster.Directory" , "com.alibaba.dubbo.common.URL" );
119
+ .getConstructor (Directory . class . getCanonicalName (), URL . class . getCanonicalName () );
110
120
if (constructor != null ) {
111
121
constructor .addInterceptor (DubboClusterInvokerInterceptor .class );
112
122
}
113
- InstrumentMethod invokeMethod = target .getDeclaredMethod ("invoke" , "com.alibaba.dubbo.rpc.Invocation" );
123
+ InstrumentMethod invokeMethod = target .getDeclaredMethod ("invoke" , Invocation . class . getCanonicalName () );
114
124
if (invokeMethod != null ) {
115
125
invokeMethod .addInterceptor (DubboInvokeInterceptor .class );
116
126
}
117
127
return target .toBytecode ();
118
128
}
119
129
}
120
130
121
- public static class AbstractExporterTransform implements TransformCallback {
131
+ public static class ExporterTransform implements TransformCallback {
122
132
123
133
@ Override
124
134
public byte [] doInTransform (Instrumentor instrumentor , ClassLoader loader , String className ,
125
135
Class <?> classBeingRedefined , ProtectionDomain protectionDomain , byte [] classfileBuffer )
126
136
throws InstrumentException {
127
137
final InstrumentClass target = instrumentor .getInstrumentClass (loader , className , classfileBuffer );
128
- InstrumentMethod constructor = target .getConstructor ("com.alibaba.dubbo.rpc.Invoker" );
138
+ InstrumentMethod constructor = target .getConstructor (Invoker . class . getCanonicalName () );
129
139
if (constructor != null ) {
130
140
constructor .addInterceptor (DubboExporterInterceptor .class );
131
141
}
0 commit comments