yx91490 commented on a change in pull request #1530:
URL:
https://github.com/apache/incubator-seatunnel/pull/1530#discussion_r832787349
##########
File path:
seatunnel-core/seatunnel-core-base/src/main/java/org/apache/seatunnel/command/BaseTaskExecuteCommand.java
##########
@@ -73,6 +74,30 @@ protected final void prepare(E env, List<? extends
Plugin<E>>... plugins) {
}
}
+ /**
+ * Execute close method defined in {@link
org.apache.seatunnel.plugin.Plugin}
+ *
+ * @param plugins plugin list
+ */
+ @SafeVarargs
+ protected final void close(List<? extends Plugin<E>>... plugins) {
+ List<RuntimeException> exceptionHolder = new ArrayList<>();
+ for (List<? extends Plugin<E>> pluginList : plugins) {
+ for (Plugin<E> plugin : pluginList) {
+ try (Plugin<?> closed = plugin) {
+ // ignore
+ } catch (Exception e) {
Review comment:
I'd suggest catch Throwable.
##########
File path:
seatunnel-core/seatunnel-core-base/src/main/java/org/apache/seatunnel/command/BaseTaskExecuteCommand.java
##########
@@ -73,6 +74,30 @@ protected final void prepare(E env, List<? extends
Plugin<E>>... plugins) {
}
}
+ /**
+ * Execute close method defined in {@link
org.apache.seatunnel.plugin.Plugin}
+ *
+ * @param plugins plugin list
+ */
+ @SafeVarargs
+ protected final void close(List<? extends Plugin<E>>... plugins) {
+ List<RuntimeException> exceptionHolder = new ArrayList<>();
+ for (List<? extends Plugin<E>> pluginList : plugins) {
+ for (Plugin<E> plugin : pluginList) {
+ try (Plugin<?> closed = plugin) {
+ // ignore
+ } catch (Exception e) {
+ exceptionHolder.add(new
RuntimeException(String.format("plugin %s closed error, errorMessage: %s",
Review comment:
If you only collect message finally, you don't need to new
RuntimeException because it's too expensive.
but I suggest use Suppressed exception feature to keep stacktrace.
--
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]