Created 03-21-2023 06:50 AM
I use Impala JDBC to query, I find close() and execute() with synchronized. So if I invoke close() in other thread will wait execute() ,because if execute() is running,close() will blocked waiting for lock. So I should invoke cancal() before close() to avoid block?
Created 03-21-2023 09:45 AM
@hqbhoho Welcome to the Cloudera Community!
To help you get the best possible solution, I have tagged our Impala experts @mszurap and @bbreak who may be able to assist you further.
Please keep us updated on your post, and we hope you find a satisfactory solution to your query.
Regards,
Diana Torres,Created 03-21-2023 09:54 AM
@hqbhoho , if the query is executing, it probably makes sense to cancel it before you try to call close.
Created on 03-21-2023 06:01 PM - edited 03-21-2023 06:06 PM
@bbreak thanks, I will try. In my case, I wan't call close to close a statement. execute and close will call in different thread. So Why synchronized both close and execute? Now close will not work before execute
complete
Created 03-27-2023 01:40 PM
Closing the connection while the query is still executing is generally not good practice. Think of it as taking ownership for the query you've executed, sort of like turning the lights off before you leave a room. If you're going to close the session (leave the room), you need to first cancel the query that's consuming resources (turn off the lights you turned on). The normal expectation is that an executing query will have an associated active session.