File tree 7 files changed +20
-29
lines changed
src/main/java/org/dromara/dynamictp/common/properties
core/src/main/java/org/dromara/dynamictp/core
spring/src/main/java/org/dromara/dynamictp/spring/lifecycle 7 files changed +20
-29
lines changed Original file line number Diff line number Diff line change 11
11
<artifactId >dynamic-tp-common</artifactId >
12
12
13
13
<dependencies >
14
- <dependency >
15
- <groupId >org.springframework</groupId >
16
- <artifactId >spring-context</artifactId >
17
- </dependency >
18
-
19
14
<dependency >
20
15
<groupId >org.slf4j</groupId >
21
16
<artifactId >slf4j-api</artifactId >
60
55
<groupId >cglib</groupId >
61
56
<artifactId >cglib</artifactId >
62
57
</dependency >
58
+
63
59
<dependency >
64
60
<groupId >org.yaml</groupId >
65
61
<artifactId >snakeyaml</artifactId >
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ private DtpProperties() { }
43
43
private boolean enabled = true ;
44
44
45
45
/**
46
- * Environment, if not set, will use "spring.profiles.active ".
46
+ * Environment, if not set, will use "APP.ENV ".
47
47
*/
48
48
private String env ;
49
49
Original file line number Diff line number Diff line change @@ -59,37 +59,23 @@ public boolean isRunning() {
59
59
return this .running .get ();
60
60
}
61
61
62
- /**
63
- * Compatible with lower versions of spring.
64
- *
65
- * @param callback callback
66
- */
67
62
@ Override
68
63
public void stop (Runnable callback ) {
69
64
stop ();
70
65
callback .run ();
71
66
}
72
67
73
- /**
74
- * Compatible with lower versions of spring.
75
- *
76
- * @return isAutoStartup
77
- */
78
68
@ Override
79
69
public boolean isAutoStartup () {
80
70
return true ;
81
71
}
82
72
83
- /**
84
- * Compatible with lower versions of spring.
85
- *
86
- * @return phase
87
- */
88
73
@ Override
89
74
public int getPhase () {
90
75
return Integer .MAX_VALUE ;
91
76
}
92
77
78
+ @ Override
93
79
public void shutdownInternal () {
94
80
DtpMonitor .destroy ();
95
81
AlarmManager .destroy ();
Original file line number Diff line number Diff line change 20
20
import lombok .extern .slf4j .Slf4j ;
21
21
import org .dromara .dynamictp .common .em .CollectorTypeEnum ;
22
22
import org .dromara .dynamictp .common .entity .ThreadPoolStats ;
23
+ import org .dromara .dynamictp .common .util .BeanCopierUtil ;
23
24
import org .dromara .dynamictp .core .monitor .collector .AbstractCollector ;
24
- import org .springframework .beans .BeanUtils ;
25
25
26
26
import javax .management .JMException ;
27
27
import javax .management .MBeanServer ;
@@ -49,7 +49,7 @@ public class JMXCollector extends AbstractCollector {
49
49
public void collect (ThreadPoolStats threadPoolStats ) {
50
50
if (GAUGE_CACHE .containsKey (threadPoolStats .getPoolName ())) {
51
51
ThreadPoolStats poolStats = GAUGE_CACHE .get (threadPoolStats .getPoolName ());
52
- BeanUtils .copyProperties (threadPoolStats , poolStats );
52
+ BeanCopierUtil .copyProperties (threadPoolStats , poolStats );
53
53
} else {
54
54
try {
55
55
MBeanServer server = ManagementFactory .getPlatformMBeanServer ();
Original file line number Diff line number Diff line change 28
28
import org .dromara .dynamictp .common .entity .NotifyPlatform ;
29
29
import org .dromara .dynamictp .common .entity .TpMainFields ;
30
30
import org .dromara .dynamictp .common .notifier .Notifier ;
31
+ import org .dromara .dynamictp .common .util .BeanCopierUtil ;
31
32
import org .dromara .dynamictp .common .util .CommonUtil ;
32
33
import org .dromara .dynamictp .common .util .DateUtil ;
33
34
import org .dromara .dynamictp .core .notifier .alarm .AlarmCounter ;
37
38
import org .dromara .dynamictp .core .support .ExecutorWrapper ;
38
39
import org .dromara .dynamictp .core .system .SystemMetricManager ;
39
40
import org .slf4j .MDC ;
40
- import org .springframework .beans .BeanUtils ;
41
41
42
42
import java .lang .reflect .Field ;
43
43
import java .util .List ;
@@ -182,7 +182,7 @@ protected String formatReceivers(String receives) {
182
182
183
183
private NotifyPlatform newTargetPlatform (NotifyPlatform platform ) {
184
184
NotifyPlatform targetPlatform = new NotifyPlatform ();
185
- BeanUtils .copyProperties (platform , targetPlatform );
185
+ BeanCopierUtil .copyProperties (platform , targetPlatform );
186
186
187
187
BaseNotifyCtx context = DtpNotifyCtxHolder .get ();
188
188
NotifyItem item = context .getNotifyItem ();
Original file line number Diff line number Diff line change 18
18
package org .dromara .dynamictp .core .support ;
19
19
20
20
import lombok .extern .slf4j .Slf4j ;
21
- import org .springframework .scheduling .concurrent .ThreadPoolTaskExecutor ;
22
21
23
22
import java .util .Objects ;
24
23
import java .util .concurrent .ExecutorService ;
28
27
import java .util .concurrent .TimeUnit ;
29
28
30
29
/**
31
- * DtpLifecycleSupport which mainly implements Spring bean's lifecycle management,
32
- * mimics spring internal thread pool {@link ThreadPoolTaskExecutor}.
30
+ * DtpLifecycleSupport which mainly implements ThreadPoolExecutor's lifecycle management.
33
31
*
34
32
* @author yanhom
35
33
* @since 1.0.3
Original file line number Diff line number Diff line change @@ -53,17 +53,28 @@ public boolean isRunning() {
53
53
return isRunning ;
54
54
}
55
55
56
+ @ Override
56
57
public void stop (Runnable callback ) {
57
- lifeCycleManagement .stop ();
58
+ lifeCycleManagement .stop (callback );
58
59
callback .run ();
59
60
isRunning = false ;
60
61
}
61
62
63
+ /**
64
+ * Compatible with lower versions of spring.
65
+ *
66
+ * @return isAutoStartup
67
+ */
62
68
@ Override
63
69
public boolean isAutoStartup () {
64
70
return lifeCycleManagement .isAutoStartup ();
65
71
}
66
72
73
+ /**
74
+ * Compatible with lower versions of spring.
75
+ *
76
+ * @return phase
77
+ */
67
78
@ Override
68
79
public int getPhase () {
69
80
return lifeCycleManagement .getPhase ();
You can’t perform that action at this time.
0 commit comments