[ 
https://issues.apache.org/jira/browse/HIVE-1482?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12895344#action_12895344
 ] 

John Sichi commented on HIVE-1482:
----------------------------------

Yes, synchronized is the way to go.

I think the synchronization has to be at the connection level.  For example, 
HiveStatement also needs to make calls on the thrift interface.  It's not just 
DatabaseMetaData.

So we should add a new data member to HiveConnection:

Object connectionMutex = new Object();

Then pass connectionMutex to constructors of sub-objects which need to 
participate in synchronization.  They can then do

synchronized(connectionMutex) {
...
}

around their critical sections.

Creating a separate object for this purpose allows us to keep control over 
synchronization (e.g. so it doesn't get mixed up with user-level or 
thrift-level synchronization code later).  We'll also need to be able to skip 
synchronization in the case of asynchronous cancel, but that's a separate task.

We should also review to see if there is any client-side state which needs 
protection.


> Not all jdbc calls are threadsafe.
> ----------------------------------
>
>                 Key: HIVE-1482
>                 URL: https://issues.apache.org/jira/browse/HIVE-1482
>             Project: Hadoop Hive
>          Issue Type: Bug
>          Components: Drivers
>    Affects Versions: 0.7.0
>            Reporter: Bennie Schut
>             Fix For: 0.7.0
>
>
> As per jdbc spec they should be threadsafe:
> http://download.oracle.com/docs/cd/E17476_01/javase/1.3/docs/guide/jdbc/spec/jdbc-spec.frame9.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to