Skip to content

Commit

Permalink
[Functions] Check executor null when closing the FileSource (#15247)
Browse files Browse the repository at this point in the history
  • Loading branch information
nlu90 authored Apr 21, 2022
1 parent e4a8de1 commit 06ba587
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,15 @@ public void open(Map<String, Object> config, SourceContext sourceContext) throws

@Override
public void close() throws Exception {
executor.shutdown();
try {
if (!executor.awaitTermination(800, TimeUnit.MILLISECONDS)) {
if (executor != null) {
executor.shutdown();
try {
if (!executor.awaitTermination(800, TimeUnit.MILLISECONDS)) {
executor.shutdownNow();
}
} catch (InterruptedException e) {
executor.shutdownNow();
}
} catch (InterruptedException e) {
executor.shutdownNow();
}
}
}

0 comments on commit 06ba587

Please sign in to comment.