You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "linghengqian (via GitHub)" <gi...@apache.org> on 2025/09/05 11:04:59 UTC
Re: [PR] feat: Support business code capture interruption during exit [shardingsphere-elasticjob]
linghengqian commented on code in PR #2475:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/2475#discussion_r2324783251
##########
test/native/src/test/java/org/apache/shardingsphere/elasticjob/test/natived/it/operation/JavaTest.java:
##########
@@ -305,4 +308,47 @@ void testShardingStatisticsAPI() {
});
job.shutdown();
}
+
+ @Test
+ void testGivenOneShardingCountWhenShutdownThenTaskCanCaptureInterruptedException() throws Exception {
+ testCaptureInterruptedException(1);
+ }
+
+ @Test
+ void testGivenOneMoreShardingCountWhenShutdownThenTaskCanCaptureInterruptedException() throws Exception {
+ testCaptureInterruptedException(2);
+ }
Review Comment:
- I will say that I'm confused as to why the unit tests for this change are placed in a separate integration test module.
##########
test/native/src/test/java/org/apache/shardingsphere/elasticjob/test/natived/it/operation/JavaTest.java:
##########
@@ -305,4 +308,47 @@ void testShardingStatisticsAPI() {
});
job.shutdown();
}
+
+ @Test
+ void testGivenOneShardingCountWhenShutdownThenTaskCanCaptureInterruptedException() throws Exception {
+ testCaptureInterruptedException(1);
+ }
+
+ @Test
+ void testGivenOneMoreShardingCountWhenShutdownThenTaskCanCaptureInterruptedException() throws Exception {
+ testCaptureInterruptedException(2);
+ }
+
+ private void testCaptureInterruptedException(int shardingTotalCount) throws Exception {
+ String jobName = "testTaskCaptureInterruptedTask";
+ final AtomicBoolean captured = new AtomicBoolean(false);
+ // start in 2 seconds
Review Comment:
- I have the impression that ShardingSphere's code constraints don't like inline comments, as Javadoc doesn't display them. Can you change the comments to Javadoc style, or remove the inline comments?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org