ruanwenjun opened a new issue #1529: URL: https://github.com/apache/incubator-seatunnel/issues/1529
### Search before asking - [X] I had searched in the [feature](https://github.com/apache/incubator-seatunnel/issues?q=is%3Aissue+label%3A%22Feature%22) and found no similar feature requirement. ### Description Currently, we just has defined `prepare` method in `Plugin`, this can be thought as a lifecycle function after plugin created. Sometimes we need to do some operation, after plugin executed. For example, we hope to release some sources like threadpool or JDBC connection after batch mode finished. It might be needed to provide more lifecycle method. I plan to create a Lifecycle interface. ```java public interface LifeCycle<T> { /** * Open method. * * @param env envType */ void open(T env); /** * Close method. */ void close() throws Exception; } ``` And the Plugin will implement with LifeCycle. Before we start to execute the job, we will execute the open method to apply some resources. After we finish the job, we can execute the close method to release some resources. This may be useful in batch job. ```java try { open(configBuilder.getEnv(), sources, transforms, sinks); execution.start(sources, transforms, sinks); close(sources, transforms, sinks); } catch (Exception e) { throw new RuntimeException("Execute Flink task error", e); } ``` ### Usage Scenario _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- 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]
