Hello!
I'm trying to close all DB connections when a certain event is registered. The verticle running this flow is later undeployed, so all DB connections do eventually get closed, but it seems they have to wait for the asynchronous responses. This is vertx version 3.5.0.
This is the basic setup:
futureForMyEvent.setHandler(result -> {
connection.close(closed -> {
});
connection.close();
});
connection.query(sql, result -> {
try/catch/finally.
the finally closes the connection
});
So after the query statement, and before its response, I'm triggering that event to happen manually.
What ends up happening is that the future handler immediately executes, but the connection close handler doesn't execute yet. Like this:
- query sent
- event triggered/future completed
- future handler runs
- Undeploy begins
- time passes
- query result returns/the finally block closes the connection
- connection close handler runs
- Undeploy finishes
Is there a way to kill the connection outright? Or maybe a way to cancel any asynchronous requests? I don't care for the response in the case of this event.
Thanks!!
Danny