WebhookClient process still running after its closure
youpi0214 opened this issue · 5 comments
I tried to run a simple code to test my webhook. I did succeed at sending my message but the program kept running after it and i also received an SLF4 error. dunno why
code:
var url = "my webhook link";
try (WebhookClient webhook = WebhookClient.withUrl(url)) {
webhook.send("test").thenRun(() -> {
System.out.println("message sent");
});
}
output:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
message sent
i also tried by explicitly closing the webhookclient without using the try(){ } statement but the issue still persist
I'm using intellij and jdk 11.0.10
library version i'm using is 0.5.5-rc
SLF4 has nothing to do with discord-webhooks it's a logging lib.
What should i do ? I resolved SLF4 error but the Thread is still not dying after sending the message
This is because the OkHTTP client creates a thread which takes a bit longer to timeout. If you configure your own OkHTTP client you can use
client.connectionPool().evictAll();
client.dispatcher().executorService().shutdown();
@MinnDevelopment OkHTTP cannot be injected. How can I config my own Okhttp client?