[
https://issues.apache.org/jira/browse/HIVE-20737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16648315#comment-16648315
]
Denys Kuzmenko edited comment on HIVE-20737 at 10/15/18 3:02 PM:
-----------------------------------------------------------------
[~stakiar] Sorry, I just realised that we have only session and maintenance
threads. So race condition is not possible. But I think it's better to have
check condition inside of the open method to reduce risk of having it called
twice.
was (Author: dkuzmenko):
{code:java}
public void open(HiveConf conf) throws HiveException {
closeLock.readLock().lock();
try {
...
hiveSparkClient = HiveSparkClientFactory.createHiveSparkClient(conf,
sessionId,
SessionState.get().getSessionId());
...
} finally {
closeLock.readLock().unlock();
}
}
{code}
Double-checked locking should be used, otherwise, it might happen, than inner
logic of the "open" method will be attempted multiple times, even when session
is already open.
> In local mode SparkContext is shared between user sessions and should be
> closed only when there is no active one
> ----------------------------------------------------------------------------------------------------------------
>
> Key: HIVE-20737
> URL: https://issues.apache.org/jira/browse/HIVE-20737
> Project: Hive
> Issue Type: Bug
> Components: Hive
> Reporter: Denys Kuzmenko
> Assignee: Denys Kuzmenko
> Priority: Major
> Attachments: HIVE-20737.1.patch, HIVE-20737.2.patch,
> HIVE-20737.5.patch, HIVE-20737.6.patch
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)