kezhenxu94 commented on a change in pull request #1530:
URL: 
https://github.com/apache/incubator-seatunnel/pull/1530#discussion_r832140268



##########
File path: 
seatunnel-apis/seatunnel-api-base/src/main/java/org/apache/seatunnel/plugin/Plugin.java
##########
@@ -25,9 +25,21 @@
 import java.io.Serializable;
 
 /**
- * a base interface indicates belonging to SeaTunnel.
+ * A base interface indicates belonging to SeaTunnel.
+ * Plugin will be used as follows:
+ * <pre>{@code
+ *      Plugin<?> plugin = new PluginA<>();
+ *      plugin.setConfig(Config);
+ *      CheckResult checkResult = plugin.checkConfig();
+ *      if (checkResult.getSuccess()) {
+ *         plugin.prepare();
+ *         // plugin execute code
+ *         plugin.close();

Review comment:
       What about
   
   ```suggestion
    *      try (Plugin<?> plugin = new PluginA<>()) { // Put the plugin in 
try-with-resource to ensure it's always closed.
    *        plugin.setConfig(Config);
    *        CheckResult checkResult = plugin.checkConfig();
    *        if (checkResult.getSuccess()) {
    *          plugin.prepare();
    *          // plugin execute code
    *        }
    *.     }
   ```

##########
File path: 
seatunnel-apis/seatunnel-api-base/src/main/java/org/apache/seatunnel/plugin/Plugin.java
##########
@@ -25,9 +25,21 @@
 import java.io.Serializable;
 
 /**
- * a base interface indicates belonging to SeaTunnel.
+ * A base interface indicates belonging to SeaTunnel.
+ * Plugin will be used as follows:
+ * <pre>{@code
+ *      Plugin<?> plugin = new PluginA<>();
+ *      plugin.setConfig(Config);
+ *      CheckResult checkResult = plugin.checkConfig();
+ *      if (checkResult.getSuccess()) {
+ *         plugin.prepare();
+ *         // plugin execute code
+ *         plugin.close();

Review comment:
       What about
   
   ```suggestion
    *      try (Plugin<?> plugin = new PluginA<>()) { // Put the plugin in 
try-with-resource block to ensure it's always closed.
    *        plugin.setConfig(Config);
    *        CheckResult checkResult = plugin.checkConfig();
    *        if (checkResult.getSuccess()) {
    *          plugin.prepare();
    *          // plugin execute code
    *        }
    *.     }
   ```




-- 
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]


Reply via email to