GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — 1.For springboot, add EVENT BEFORE_BEAN_REGIST to perform bytecode re… · optimuse/uavstack@6ec5bca

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • com.creditease.uav.hook.dubbo/src/main/java/com/creditease/uav/hook/dubbo
    • DubboHookProxy.java
  • com.creditease.uav.hook.httpclients/src/main/java/com/creditease/uav/hook
    • httpclients3/sync
      • HttpClient3HookProxy.java
    • httpclients
      • async
        • HttpAsyncClientHookProxy.java
      • sync
        • HttpClientHookProxy.java
  • com.creditease.uav.hook.jaxws/src/main/java/com/creditease/uav/hook/jaxws
    • JaxWSHookProxy.java
  • com.creditease.uav.hook.jdbc/src/main/java/com/creditease/uav/hook/jdbc
    • JdbcHookProxy.java
    • pools
      • AbsDBPoolHookProxy.java
      • dbcp
        • DBCPHookProxy.java
      • hikari
        • HikariHookProxy.java
      • mybatis
        • MybatisHookProxy.java
  • com.creditease.uav.hook.mongoclients/src/main/java/com/creditease/uav/hook/mongoclients
    • MongoClientHookProxy.java
  • com.creditease.uav.hook.mq/src/main/java/com/creditease/uav/hook
    • rabbitmq
      • RabbitmqHookProxy.java
    • rocketmq
      • RocketmqHookProxy.java
  • com.creditease.uav.hook.redis/src/main/java/com/creditease/uav/hook/redis
    • aredis
      • AredisHookProxy.java
    • jedis
      • JedisHookProxy.java
    • lettuce
      • LettuceHookProxy.java
  • com.creditease.uav.monitorframework.agent/src/main/java/com/creditease/uav/monitorframework/adaptors
    • SpringBootTomcatAdaptor.java
  • com.creditease.uav.monitorframework.dproxy/src/main/java/com/creditease/uav/monitorframework/webservice/listeners
    • WebServiceListener.java
  • com.creditease.uav.monitorframework.springbootFat
    • pom.xml
    • src/main
      • java
        • com/creditease
          • monitorframework/fat/dubbo
            • IMyDubboService.java
            • MyDubboService.java
          • uav/monitorframework/springbootFat
            • CxfConfig.java
        • config.xml
      • resources
        • application.properties
        • config.xml
  • com.creditease.uav.monitorframework/src/main/java/com/creditease
    • monitor
      • appfra/hook/spi
        • HookProxy.java
      • interceptframework
        • StandardInterceptContextHelper.java
        • spi
          • InterceptContext.java
    • uav/appserver/listeners
      • AppFrkHookFactoryListener.java
  • com.creditease.uav.tomcat.plus.core/src/main/java/com/creditease/tomcat/plus/interceptor
    • SpringBootTomcatPlusIT.java
    • TomcatPlusIT.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎com.creditease.uav.hook.dubbo/src/main/java/com/creditease/uav/hook/dubbo/DubboHookProxy.java‎

Copy file name to clipboardExpand all lines: com.creditease.uav.hook.dubbo/src/main/java/com/creditease/uav/hook/dubbo/DubboHookProxy.java
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public void start(HookContext context, ClassLoader webapploader) {
5151
Event evt = context.get(Event.class);
5252

5353
switch (evt) {
54+
case SPRING_BEAN_REGIST:
5455
case WEBCONTAINER_INIT:
5556
InsertInterceptToClients(context, webapploader);
5657
break;
@@ -69,6 +70,9 @@ public void start(HookContext context, ClassLoader webapploader) {
6970

7071
private void InsertInterceptToClients(HookContext context, ClassLoader webapploader) {
7172

73+
if (isHookEventDone("InsertInterceptToClients")) {
74+
return;
75+
}
7276
InterceptContext ic = (InterceptContext) context.get(HookConstants.INTERCEPTCONTEXT);
7377

7478
String contextPath = (String) ic.get(InterceptConstants.CONTEXTPATH);
Collapse file

‎com.creditease.uav.hook.httpclients/src/main/java/com/creditease/uav/hook/httpclients/async/HttpAsyncClientHookProxy.java‎

Copy file name to clipboardExpand all lines: com.creditease.uav.hook.httpclients/src/main/java/com/creditease/uav/hook/httpclients/async/HttpAsyncClientHookProxy.java
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public void start(HookContext context, ClassLoader webapploader) {
5757
Event evt = context.get(Event.class);
5858

5959
switch (evt) {
60+
case SPRING_BEAN_REGIST:
6061
case WEBCONTAINER_INIT:
6162
InsertInterceptToClients(context, webapploader);
6263
break;
@@ -76,6 +77,10 @@ public void start(HookContext context, ClassLoader webapploader) {
7677

7778
public void InsertInterceptToClients(HookContext context, ClassLoader webapploader) {
7879

80+
if (isHookEventDone("InsertInterceptToClients")) {
81+
return;
82+
}
83+
7984
InterceptContext ic = (InterceptContext) context.get(HookConstants.INTERCEPTCONTEXT);
8085

8186
String contextPath = (String) ic.get(InterceptConstants.CONTEXTPATH);
Collapse file

‎com.creditease.uav.hook.httpclients/src/main/java/com/creditease/uav/hook/httpclients/sync/HttpClientHookProxy.java‎

Copy file name to clipboardExpand all lines: com.creditease.uav.hook.httpclients/src/main/java/com/creditease/uav/hook/httpclients/sync/HttpClientHookProxy.java
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public void start(HookContext context, ClassLoader webapploader) {
5656
Event evt = context.get(Event.class);
5757

5858
switch (evt) {
59+
case SPRING_BEAN_REGIST:
5960
case WEBCONTAINER_INIT:
6061
InsertInterceptToClients(context, webapploader);
6162
break;
@@ -76,6 +77,10 @@ public void start(HookContext context, ClassLoader webapploader) {
7677

7778
public void InsertInterceptToClients(HookContext context, ClassLoader webapploader) {
7879

80+
if (isHookEventDone("InsertInterceptToClients")) {
81+
return;
82+
}
83+
7984
InterceptContext ic = (InterceptContext) context.get(HookConstants.INTERCEPTCONTEXT);
8085

8186
String contextPath = (String) ic.get(InterceptConstants.CONTEXTPATH);
Collapse file

‎com.creditease.uav.hook.httpclients/src/main/java/com/creditease/uav/hook/httpclients3/sync/HttpClient3HookProxy.java‎

Copy file name to clipboardExpand all lines: com.creditease.uav.hook.httpclients/src/main/java/com/creditease/uav/hook/httpclients3/sync/HttpClient3HookProxy.java
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public void start(HookContext context, ClassLoader webapploader) {
5656
Event evt = context.get(Event.class);
5757

5858
switch (evt) {
59+
case SPRING_BEAN_REGIST:
5960
case WEBCONTAINER_RESOURCE_INIT:
6061
break;
6162
case WEBCONTAINER_INIT:
@@ -76,6 +77,10 @@ public void start(HookContext context, ClassLoader webapploader) {
7677

7778
public void InsertInterceptToClients(HookContext context, ClassLoader webapploader) {
7879

80+
if (isHookEventDone("InsertInterceptToClients")) {
81+
return;
82+
}
83+
7984
InterceptContext ic = (InterceptContext) context.get(HookConstants.INTERCEPTCONTEXT);
8085
String contextPath = (String) ic.get(InterceptConstants.CONTEXTPATH);
8186
String basePath = (String) ic.get(InterceptConstants.BASEPATH);
Collapse file

‎com.creditease.uav.hook.jaxws/src/main/java/com/creditease/uav/hook/jaxws/JaxWSHookProxy.java‎

Copy file name to clipboardExpand all lines: com.creditease.uav.hook.jaxws/src/main/java/com/creditease/uav/hook/jaxws/JaxWSHookProxy.java
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public void start(HookContext context, ClassLoader webapploader) {
5151

5252
Event event = context.get(Event.class);
5353
switch (event) {
54+
case SPRING_BEAN_REGIST:
5455
case WEBCONTAINER_INIT:
5556
insertIntercepter(context, webapploader);
5657
break;
@@ -70,6 +71,10 @@ public void start(HookContext context, ClassLoader webapploader) {
7071

7172
private void insertIntercepter(HookContext context, ClassLoader webapploader) {
7273

74+
if (isHookEventDone("InsertInterceptToClients")) {
75+
return;
76+
}
77+
7378
InterceptContext ic = (InterceptContext) context.get(HookConstants.INTERCEPTCONTEXT);
7479

7580
String contextPath = (String) ic.get(InterceptConstants.CONTEXTPATH);
@@ -87,7 +92,7 @@ public void doInstallDProxy(ClassLoader webapploader, final String appid) {
8792
dpInstall.setTargetClassLoader(webapploader);
8893

8994
/**
90-
* install proxy to InternalHttpAsyncClient
95+
* install proxy to javax.xml.ws.Service
9196
*/
9297
dpInstall.installProxy("javax.xml.ws.Service", new String[] { "com.creditease.uav.hook.jaxws.interceptors" },
9398
new DynamicProxyProcessor() {
Collapse file

‎com.creditease.uav.hook.jdbc/src/main/java/com/creditease/uav/hook/jdbc/JdbcHookProxy.java‎

Copy file name to clipboardExpand all lines: com.creditease.uav.hook.jdbc/src/main/java/com/creditease/uav/hook/jdbc/JdbcHookProxy.java
+7-26Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,9 @@ public class JdbcHookProxy extends HookProxy {
4444

4545
private final DynamicProxyInstaller dpInstall;
4646

47-
private boolean isInjectDrvMgr = false;
48-
private boolean isInjectDruid = false;
49-
private boolean isInjectDBCP2 = false;
50-
private boolean isInjectTomcatDBCP2 = false;
51-
private boolean isInjectHikari = false;
52-
private boolean isInjectDataSource = false;
53-
5447
@SuppressWarnings("rawtypes")
5548
public JdbcHookProxy(String id, Map config) {
5649
super(id, config);
57-
5850
dpInstall = new DynamicProxyInstaller();
5951
}
6052

@@ -64,6 +56,7 @@ public void start(HookContext context, ClassLoader webapploader) {
6456
Event event = context.get(Event.class);
6557
InterceptContext ic = (InterceptContext) context.get(HookConstants.INTERCEPTCONTEXT);
6658
switch (event) {
59+
case SPRING_BEAN_REGIST:
6760
case WEBCONTAINER_RESOURCE_INIT:
6861
this.injectDriverManager(webapploader, ic);
6962
this.injectDBCP2(webapploader, ic);
@@ -113,12 +106,10 @@ private String getAppID(InterceptContext ic) {
113106
*/
114107
private void injectDriverManager(ClassLoader webapploader, InterceptContext ic) {
115108

116-
if (this.isInjectDrvMgr == true) {
109+
if (isHookEventDone("isInjectDrvMgr")) {
117110
return;
118111
}
119112

120-
this.isInjectDrvMgr = true;
121-
122113
JdbcDriverIT jdbcDriverIT = new JdbcDriverIT(this.getAppID(ic));
123114

124115
jdbcDriverIT.initSomeDrivers(webapploader);
@@ -149,12 +140,10 @@ private void injectDataSource(InterceptContext ic) {
149140
return;
150141
}
151142

152-
if (this.isInjectDataSource == true) {
143+
if (isHookEventDone("isInjectDataSource")) {
153144
return;
154145
}
155146

156-
this.isInjectDataSource = true;
157-
158147
JdbcDriverIT jdbcDriverIT = new JdbcDriverIT(this.getAppID(ic));
159148

160149
ServerVendor vendor = (ServerVendor) this.getServerInfo(CaptureConstants.INFO_APPSERVER_VENDOR);
@@ -188,12 +177,10 @@ private void injectTomcatDBCP2(ClassLoader webapploader, InterceptContext ic) {
188177
return;
189178
}
190179

191-
if (this.isInjectTomcatDBCP2 == true) {
180+
if (isHookEventDone("isInjectTomcatDBCP2")) {
192181
return;
193182
}
194183

195-
this.isInjectTomcatDBCP2 = true;
196-
197184
final String appid = this.getAppID(ic);
198185

199186
/**
@@ -242,12 +229,10 @@ private void injectDBCP2(ClassLoader webapploader, InterceptContext ic) {
242229
return;
243230
}
244231

245-
if (this.isInjectDBCP2 == true) {
232+
if (isHookEventDone("isInjectDBCP2")) {
246233
return;
247234
}
248235

249-
this.isInjectDBCP2 = true;
250-
251236
final String appid = this.getAppID(ic);
252237

253238
/**
@@ -294,12 +279,10 @@ private void injectHikari(ClassLoader webapploader, InterceptContext ic) {
294279
return;
295280
}
296281

297-
if (isInjectHikari == true) {
282+
if (isHookEventDone("isInjectHikari")) {
298283
return;
299284
}
300285

301-
isInjectHikari = true;
302-
303286
final String appid = this.getAppID(ic);
304287

305288
final String contextPath = (String) ic.get(InterceptConstants.CONTEXTPATH);
@@ -357,12 +340,10 @@ private void injectDruid(ClassLoader webapploader, InterceptContext ic) {
357340
return;
358341
}
359342

360-
if (this.isInjectDruid == true) {
343+
if (isHookEventDone("isInjectDruid")) {
361344
return;
362345
}
363346

364-
this.isInjectDruid = true;
365-
366347
final String appid = this.getAppID(ic);
367348

368349
/**
Collapse file

‎com.creditease.uav.hook.jdbc/src/main/java/com/creditease/uav/hook/jdbc/pools/AbsDBPoolHookProxy.java‎

Copy file name to clipboardExpand all lines: com.creditease.uav.hook.jdbc/src/main/java/com/creditease/uav/hook/jdbc/pools/AbsDBPoolHookProxy.java
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public void start(HookContext context, ClassLoader webapploader) {
5656
Event event = context.get(Event.class);
5757
InterceptContext ic = (InterceptContext) context.get(HookConstants.INTERCEPTCONTEXT);
5858
switch (event) {
59+
case SPRING_BEAN_REGIST:
5960
case WEBCONTAINER_INIT:
6061
initHook(ic);
6162
break;
@@ -89,6 +90,9 @@ public void start(HookContext context, ClassLoader webapploader) {
8990
*/
9091
private void initHook(InterceptContext ic) {
9192

93+
if (isHookEventDone("initHook")) {
94+
return;
95+
}
9296
String contextPath = (String) ic.get(InterceptConstants.CONTEXTPATH);
9397
String basePath = (String) ic.get(InterceptConstants.BASEPATH);
9498
appid = MonitorServerUtil.getApplicationId(contextPath, basePath);
Collapse file

‎com.creditease.uav.hook.jdbc/src/main/java/com/creditease/uav/hook/jdbc/pools/dbcp/DBCPHookProxy.java‎

Copy file name to clipboardExpand all lines: com.creditease.uav.hook.jdbc/src/main/java/com/creditease/uav/hook/jdbc/pools/dbcp/DBCPHookProxy.java
+5-7Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ public class DBCPHookProxy extends AbsDBPoolHookProxy {
4646

4747
protected DynamicProxyInstaller dpInstall;
4848

49-
private boolean isInit = false;
50-
5149
@SuppressWarnings("rawtypes")
5250
public DBCPHookProxy(String id, Map config) {
5351
super(id, config);
@@ -62,6 +60,7 @@ public void start(HookContext context, ClassLoader webapploader) {
6260

6361
Event event = context.get(Event.class);
6462
switch (event) {
63+
case SPRING_BEAN_REGIST:
6564
case WEBCONTAINER_RESOURCE_INIT:
6665
case WEBCONTAINER_INIT:
6766
InsertInterceptToClients(context, webapploader);
@@ -93,16 +92,15 @@ public void start(HookContext context, ClassLoader webapploader) {
9392
*/
9493
private void InsertInterceptToClients(HookContext context, ClassLoader webapploader) {
9594

95+
if (isHookEventDone("InsertInterceptToClients")) {
96+
return;
97+
}
98+
9699
InterceptContext ic = (InterceptContext) context.get(HookConstants.INTERCEPTCONTEXT);
97100
String contextPath = (String) ic.get(InterceptConstants.CONTEXTPATH);
98101
String basePath = (String) ic.get(InterceptConstants.BASEPATH);
99102
appid = MonitorServerUtil.getApplicationId(contextPath, basePath);
100103

101-
if (isInit == true) {
102-
return;
103-
}
104-
105-
isInit = true;
106104
/**
107105
* set the webapploader is the target classloader
108106
*/
Collapse file

‎com.creditease.uav.hook.jdbc/src/main/java/com/creditease/uav/hook/jdbc/pools/hikari/HikariHookProxy.java‎

Copy file name to clipboardExpand all lines: com.creditease.uav.hook.jdbc/src/main/java/com/creditease/uav/hook/jdbc/pools/hikari/HikariHookProxy.java
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public void start(HookContext context, ClassLoader webapploader) {
5858

5959
Event event = context.get(Event.class);
6060
switch (event) {
61+
case SPRING_BEAN_REGIST:
6162
case WEBCONTAINER_RESOURCE_INIT:
6263
case WEBCONTAINER_INIT:
6364
InsertInterceptToClients(context, webapploader);
@@ -89,16 +90,15 @@ public void start(HookContext context, ClassLoader webapploader) {
8990
*/
9091
private void InsertInterceptToClients(HookContext context, ClassLoader webapploader) {
9192

93+
if (isHookEventDone("InsertInterceptToClients")) {
94+
return;
95+
}
96+
9297
InterceptContext ic = (InterceptContext) context.get(HookConstants.INTERCEPTCONTEXT);
9398
String contextPath = (String) ic.get(InterceptConstants.CONTEXTPATH);
9499
String basePath = (String) ic.get(InterceptConstants.BASEPATH);
95100
appid = MonitorServerUtil.getApplicationId(contextPath, basePath);
96101

97-
if (isInit == true) {
98-
return;
99-
}
100-
101-
isInit = true;
102102
// /**
103103
// * set the webapploader is the target classloader
104104
// */
Collapse file

‎com.creditease.uav.hook.jdbc/src/main/java/com/creditease/uav/hook/jdbc/pools/mybatis/MybatisHookProxy.java‎

Copy file name to clipboardExpand all lines: com.creditease.uav.hook.jdbc/src/main/java/com/creditease/uav/hook/jdbc/pools/mybatis/MybatisHookProxy.java
+6-8Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ public class MybatisHookProxy extends AbsDBPoolHookProxy {
4949
protected DynamicProxyInstaller dpInstall;
5050

5151
private ClassLoader webapploaderForMybatis = null;
52-
private boolean isInit = false;
5352

5453
@SuppressWarnings("rawtypes")
5554
public MybatisHookProxy(String id, Map config) {
@@ -65,6 +64,7 @@ public void start(HookContext context, ClassLoader webapploader) {
6564
webapploaderForMybatis = webapploader;
6665
Event event = context.get(Event.class);
6766
switch (event) {
67+
case SPRING_BEAN_REGIST:
6868
case WEBCONTAINER_RESOURCE_INIT:
6969
case WEBCONTAINER_INIT:
7070
InsertInterceptToClients(context, webapploader);
@@ -111,17 +111,15 @@ protected void collectDBPoolMetrics(MonitorElement clientElem) {
111111

112112
private void InsertInterceptToClients(HookContext context, ClassLoader webapploader) {
113113

114+
if (isHookEventDone("InsertInterceptToClients")) {
115+
return;
116+
}
117+
114118
InterceptContext ic = (InterceptContext) context.get(HookConstants.INTERCEPTCONTEXT);
115119
String contextPath = (String) ic.get(InterceptConstants.CONTEXTPATH);
116120
String basePath = (String) ic.get(InterceptConstants.BASEPATH);
117121
appid = MonitorServerUtil.getApplicationId(contextPath, basePath);
118122

119-
if (isInit == true) {
120-
return;
121-
}
122-
123-
isInit = true;
124-
125123
dpInstall.setTargetClassLoader(webapploader);
126124

127125
dpInstall.installProxy("org.apache.ibatis.datasource.pooled.PooledDataSource",
@@ -157,7 +155,7 @@ private void collectDataSourceStat(MonitorElementInstance inst, DataSource pds,
157155
ReflectHelper.invoke(className, pds, prefix + collectMtrx[i], null, null, webapploader));
158156
}
159157

160-
Object poolState = ReflectHelper.invoke(className, pds, "getPoolState", null, null,webapploader);
158+
Object poolState = ReflectHelper.invoke(className, pds, "getPoolState", null, null, webapploader);
161159

162160
for (; i < collectMtrx.length; i++) {
163161

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.