Arup Malakar created HCATALOG-627:
-------------------------------------

             Summary: NotificationListener is not thread safe
                 Key: HCATALOG-627
                 URL: https://issues.apache.org/jira/browse/HCATALOG-627
             Project: HCatalog
          Issue Type: Bug
    Affects Versions: 0.5, 0.4, 0.6
            Reporter: Arup Malakar
            Assignee: Arup Malakar


>From the code in 
>[HiveMetaStore|http://svn.apache.org/repos/asf/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java]
> it appears that only one instance of the provided listener is created which 
>then gets used by the thread pool. But the methods in the 
>NotificationListnener in HCatalog is not threadsafe. For example according to 
>JMS api documentation a Connection object can be shared among threads, but the 
>[Session|http://docs.oracle.com/javaee/1.4/api/javax/jms/Session.html] [1] 
>object should be specific to a thread. 
| A Session object is a single-threaded context for producing and consuming 
messages. Although it may allocate provider resources outside the Java virtual 
machine (JVM), it is considered a lightweight JMS object.

But NotificationListener has only one session object which gets shared among 
threads. While testing I have observed cases where messages were getting 
drooped, using a ThreadLocal Session solved the problem for me. But I am 
interested in knowing if anyone else has seen dropped messages.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to