Skip to content

Commit 0d1742c

Browse files
Allow also ExecutorService to close properly
1 parent 29b4cc4 commit 0d1742c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/main/java/com/github/stickerifier/stickerify/bot/Stickerify.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import java.util.List;
4242
import java.util.Set;
4343
import java.util.concurrent.Executor;
44+
import java.util.concurrent.ExecutorService;
4445
import java.util.concurrent.ThreadFactory;
4546

4647
/**
@@ -94,6 +95,11 @@ public void onException(TelegramException e) {
9495
@Override
9596
public void close() {
9697
bot.removeGetUpdatesListener();
98+
99+
if (executor instanceof ExecutorService es) {
100+
es.close();
101+
}
102+
97103
bot.shutdown();
98104
}
99105

0 commit comments

Comments
 (0)