File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
main/java/com/alipay/sofa/rpc/server
test/java/com/alipay/sofa/rpc/config Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,7 @@ protected Executor buildExecutor() {
113
113
if (prestartAllCoreThreads ) {
114
114
threadPoolExecutor .prestartAllCoreThreads ();
115
115
}
116
+ threadPoolExecutor .setRejectedExecutionHandler (new SofaRejectedExecutionHandler ());
116
117
return threadPoolExecutor ;
117
118
}
118
119
Original file line number Diff line number Diff line change 18
18
19
19
import com .alipay .sofa .rpc .server .UserThreadPool ;
20
20
import com .alipay .sofa .rpc .server .UserVirtualThreadPool ;
21
+ import com .alipay .sofa .rpc .server .SofaRejectedExecutionHandler ;
21
22
import org .junit .Assert ;
22
23
import org .junit .Test ;
24
+
23
25
import java .util .Set ;
24
26
import java .util .concurrent .Executor ;
27
+ import java .util .concurrent .RejectedExecutionHandler ;
25
28
import java .util .concurrent .ThreadPoolExecutor ;
26
29
27
30
public class UserThreadPoolManagerTest {
@@ -67,6 +70,16 @@ public void userThreadPoolBuildTest() {
67
70
Assert .assertNull (result );
68
71
}
69
72
73
+ @ Test
74
+ public void testRejectedExecutionHandler () {
75
+ UserThreadPool userThreadPool = new UserThreadPool ();
76
+ Executor executorService = userThreadPool .getUserExecutor ();
77
+ Assert .assertTrue (executorService instanceof ThreadPoolExecutor );
78
+ RejectedExecutionHandler rejectedExecutionHandler = ((ThreadPoolExecutor ) executorService )
79
+ .getRejectedExecutionHandler ();
80
+ Assert .assertTrue (rejectedExecutionHandler instanceof SofaRejectedExecutionHandler );
81
+ }
82
+
70
83
@ Test
71
84
public void userThreadPoolCompatibleTest () {
72
85
UserThreadPool userThreadPool = new UserThreadPool ();
You can’t perform that action at this time.
0 commit comments