You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by "njnu-seafish (via GitHub)" <gi...@apache.org> on 2025/11/18 06:43:43 UTC
[PR] [Improvement-17693][HttpTask] Support cancel http task [dolphinscheduler]
njnu-seafish opened a new pull request, #17694:
URL: https://github.com/apache/dolphinscheduler/pull/17694
<!--Thanks very much for contributing to Apache DolphinScheduler, we are happy that you want to help us improve DolphinScheduler! -->
## Purpose of the pull request
close #17693
## Brief change log
add call.cancel() to cancel the HttpTask
## Verify this pull request
<!--*(Please pick either of the following options)*-->
This pull request is code cleanup without any test coverage.
*(or)*
This pull request is already covered by existing tests, such as *(please describe tests)*.
(or)
This change added tests and can be verified as follows:
<!--*(example:)*
- *Added dolphinscheduler-dao tests for end-to-end.*
- *Added CronUtilsTest to verify the change.*
- *Manually verified the change by testing locally.* -->
(or)
## Pull Request Notice
[Pull Request Notice](https://github.com/apache/dolphinscheduler/blob/dev/docs/docs/en/contribute/join/pull-request.md)
If your pull request contains incompatible change, you should also add it to `docs/docs/en/guide/upgrade/incompatible.md`
--
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: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Improvement-17693][HttpTask] Support cancel http task [dolphinscheduler]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #17694:
URL: https://github.com/apache/dolphinscheduler/pull/17694#issuecomment-3546230873
## [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=17694) **Quality Gate failed**
Failed conditions
 [25.3% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=17694&metric=new_coverage&view=list) (required ≥ 60%)
 [B Reliability Rating on New Code](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=17694) (required ≥ A)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=17694)
##
 Catch issues before they fail your Quality Gate with our IDE extension  [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request)
--
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: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Improvement-17693][HttpTask] Support cancel http task [dolphinscheduler]
Posted by "SbloodyS (via GitHub)" <gi...@apache.org>.
SbloodyS closed pull request #17694: [Improvement-17693][HttpTask] Support cancel http task
URL: https://github.com/apache/dolphinscheduler/pull/17694
--
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: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Improvement-17693][HttpTask] Support cancel http task [dolphinscheduler]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #17694:
URL: https://github.com/apache/dolphinscheduler/pull/17694#issuecomment-3557105366
## [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=17694) **Quality Gate failed**
Failed conditions
 [55.5% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=17694&metric=new_coverage&view=list) (required ≥ 60%)
 [B Reliability Rating on New Code](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=17694) (required ≥ A)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=17694)
##
 Catch issues before they fail your Quality Gate with our IDE extension  [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request)
--
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: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Improvement-17693][HttpTask] Support cancel http task [dolphinscheduler]
Posted by "SbloodyS (via GitHub)" <gi...@apache.org>.
SbloodyS commented on code in PR #17694:
URL: https://github.com/apache/dolphinscheduler/pull/17694#discussion_r2558383006
##########
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OkHttpUtils.java:
##########
@@ -68,6 +72,59 @@ public class OkHttpUtils {
}
}
+ /**
+ * Executes a synchronous GET request and returns both the {@link Call} object (for cancellation support)
+ * and the HTTP response.
+ *
+ * <p>This method enables the caller to retain a reference to the underlying OkHttp {@link Call},
+ * allowing the request to be canceled from another thread (e.g., during task interruption).
+ * Although the execution is blocking, calling {@link Call#cancel()} concurrently will cause
+ * {@link Call#execute()} to throw an {@link IOException} with the message "canceled".
+ *
+ * @param url the target URL for the GET request (must not be null)
+ * @param okHttpRequestHeaders optional HTTP headers; may be null
+ * @param requestParams query parameters to be appended to the URL as key-value pairs; may be null
+ * @param connectTimeout connection timeout in milliseconds
+ * @param writeTimeout write (send) timeout in milliseconds
+ * @param readTimeout read (receive) timeout in milliseconds
+ * @return a wrapper containing the {@link Call} and the resulting {@link OkHttpResponse}
+ * @throws IOException if a network error occurs or the request is canceled during execution
+ * @throws RuntimeException if an unexpected error occurs during request processing
+ */
+ public static @NonNull OkHttpResult getWithCall(
Review Comment:
The current `get` method has implemented the `AutoCloseable` interface, and its connection is secure, so it doesn't need to be closed again.
--
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: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Improvement-17693][HttpTask] Support cancel http task [dolphinscheduler]
Posted by "njnu-seafish (via GitHub)" <gi...@apache.org>.
njnu-seafish commented on code in PR #17694:
URL: https://github.com/apache/dolphinscheduler/pull/17694#discussion_r2575690294
##########
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OkHttpUtils.java:
##########
@@ -68,6 +72,59 @@ public class OkHttpUtils {
}
}
+ /**
+ * Executes a synchronous GET request and returns both the {@link Call} object (for cancellation support)
+ * and the HTTP response.
+ *
+ * <p>This method enables the caller to retain a reference to the underlying OkHttp {@link Call},
+ * allowing the request to be canceled from another thread (e.g., during task interruption).
+ * Although the execution is blocking, calling {@link Call#cancel()} concurrently will cause
+ * {@link Call#execute()} to throw an {@link IOException} with the message "canceled".
+ *
+ * @param url the target URL for the GET request (must not be null)
+ * @param okHttpRequestHeaders optional HTTP headers; may be null
+ * @param requestParams query parameters to be appended to the URL as key-value pairs; may be null
+ * @param connectTimeout connection timeout in milliseconds
+ * @param writeTimeout write (send) timeout in milliseconds
+ * @param readTimeout read (receive) timeout in milliseconds
+ * @return a wrapper containing the {@link Call} and the resulting {@link OkHttpResponse}
+ * @throws IOException if a network error occurs or the request is canceled during execution
+ * @throws RuntimeException if an unexpected error occurs during request processing
+ */
+ public static @NonNull OkHttpResult getWithCall(
Review Comment:
> The current `get` method has implemented the `AutoCloseable` interface, and its connection is secure, so it doesn't need to be closed again.
During execution, the process is manually killed by the user or terminated due to a timeout.
--
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: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Improvement-17693][HttpTask] Support cancel http task [dolphinscheduler]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #17694:
URL: https://github.com/apache/dolphinscheduler/pull/17694#issuecomment-3557100308
## [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=17694) **Quality Gate failed**
Failed conditions
 [55.5% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=17694&metric=new_coverage&view=list) (required ≥ 60%)
 [B Reliability Rating on New Code](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=17694) (required ≥ A)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=17694)
##
 Catch issues before they fail your Quality Gate with our IDE extension  [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request)
--
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: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Improvement-17693][HttpTask] Support cancel http task [dolphinscheduler]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #17694:
URL: https://github.com/apache/dolphinscheduler/pull/17694#issuecomment-3546237835
## [](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=17694) **Quality Gate failed**
Failed conditions
 [25.3% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=17694&metric=new_coverage&view=list) (required ≥ 60%)
 [B Reliability Rating on New Code](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=17694) (required ≥ A)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=17694)
##
 Catch issues before they fail your Quality Gate with our IDE extension  [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request)
--
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: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Improvement-17693][HttpTask] Support cancel http task [dolphinscheduler]
Posted by "SbloodyS (via GitHub)" <gi...@apache.org>.
SbloodyS commented on code in PR #17694:
URL: https://github.com/apache/dolphinscheduler/pull/17694#discussion_r2558383006
##########
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OkHttpUtils.java:
##########
@@ -68,6 +72,59 @@ public class OkHttpUtils {
}
}
+ /**
+ * Executes a synchronous GET request and returns both the {@link Call} object (for cancellation support)
+ * and the HTTP response.
+ *
+ * <p>This method enables the caller to retain a reference to the underlying OkHttp {@link Call},
+ * allowing the request to be canceled from another thread (e.g., during task interruption).
+ * Although the execution is blocking, calling {@link Call#cancel()} concurrently will cause
+ * {@link Call#execute()} to throw an {@link IOException} with the message "canceled".
+ *
+ * @param url the target URL for the GET request (must not be null)
+ * @param okHttpRequestHeaders optional HTTP headers; may be null
+ * @param requestParams query parameters to be appended to the URL as key-value pairs; may be null
+ * @param connectTimeout connection timeout in milliseconds
+ * @param writeTimeout write (send) timeout in milliseconds
+ * @param readTimeout read (receive) timeout in milliseconds
+ * @return a wrapper containing the {@link Call} and the resulting {@link OkHttpResponse}
+ * @throws IOException if a network error occurs or the request is canceled during execution
+ * @throws RuntimeException if an unexpected error occurs during request processing
+ */
+ public static @NonNull OkHttpResult getWithCall(
Review Comment:
The current `get` method has implemented the AutoCloseable interface, and its connection is secure, so it doesn't need to be closed again.
--
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: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org