kezhenxu94 commented on a change in pull request #1530:
URL:
https://github.com/apache/incubator-seatunnel/pull/1530#discussion_r831812068
##########
File path:
seatunnel-apis/seatunnel-api-base/src/main/java/org/apache/seatunnel/plugin/Plugin.java
##########
@@ -39,7 +51,24 @@ default CheckResult checkConfig() {
return CheckResult.success();
}
- default void prepare(T prepareEnv) {
+ /**
+ * This is a lifecycle method, this method will be executed after Plugin
created.
+ *
+ * @param env environment
+ */
+ default void prepare(T env) {
+
+ }
+
+ /**
+ * This is a lifecycle method, this method will be executed before Plugin
destroy.
+ * It's used to release some resource. We will have multiple plugin, if
the former plugin throw exception when close,
+ * The follow plugins will not be close.
+ *
+ * @throws Exception when close failed.
+ */
+ default void close() throws Exception {
Review comment:
I'd consider this is not acceptable for users or plugin developers.
Plugin developers write a plugin and have a `close` method to clean the
resources, they don't even know how the `close` method will be invoked,
individually or as you said `We will have multiple plugin, if the former plugin
throw exception when close,`, if I were a plugin developer, I assume the
`close` method of my plugin should be ALWAYS invoked no matter how other
plugins' `close` methods behave .
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]