[ 
https://issues.apache.org/jira/browse/HCATALOG-370?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13423557#comment-13423557
 ] 

Rajesh Balamohan commented on HCATALOG-370:
-------------------------------------------

>>
3. If the finalizer approach is not acceptable for 
FinalizableHiveMetaStoreClient, we can have an alternate option of exposing 
acquire(), release() by the cached object for implicit cleanup on expiry. But 
that would require doing those operations for doing any HiveMetaStoreClient 
operation.
>>

Instead of finalize() which is not guaranteed, can we consider 2 additional 
steps? First would be to add removalListener() in guava cache. In case the 
cache is expired, it would take care of closing the hivemetastoreclient 
gracefully. Second step would be to add shutdown hook in JVM, which would 
iterate through the cache entries and close them gracefully before JVM shutdown.
                
> Create a HiveMetaStoreClient cache in hcatalog
> ----------------------------------------------
>
>                 Key: HCATALOG-370
>                 URL: https://issues.apache.org/jira/browse/HCATALOG-370
>             Project: HCatalog
>          Issue Type: Improvement
>          Components: client
>    Affects Versions: 0.4
>            Reporter: Rohini Palaniswamy
>            Assignee: Arup Malakar
>            Priority: Minor
>         Attachments: J370.patch
>
>
>   Hcat makes multiple calls to hivemetastore client and every time the 
> connection is setup and destroyed which is costly. It would be nice to have a 
> centralized cache, that has a connection per unique identifier (ugi,hcat 
> server uri and anything else mandatory). Instead of creating clients all over 
> the code, it can be retrieved from this cache. Connections in the cache can 
> be closed using WeakReference and ReferenceQueue or based on some time 
> interval. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to