- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Why Impala JDBC close() and execute() with synchronized
- Labels:
-
Apache Impala
Created 03-21-2023 06:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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,Community Moderator
Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community:
Created 03-21-2023 09:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.