Yeah, looks like it is not written thread-safe. As you suggest, we should note that at the least. You think it possible to make it thread-safe Jon? Is it onerous running multiple clients or a pool of clients?
Thanks, M On Mon, Sep 24, 2018 at 11:04 AM Jon Poulton <[email protected]> wrote: > I was looking at moving up to the 2.1 version of the HBase REST API and was > poking around the code base wondering how I set headers on a per request > basis, when I noticed the the "Client" class at: > > https://github.com/apache/hbase/blob/branch-2.1/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/client/Client.java > appears to have HttpGet and HttpResponse instance variables (line 68 and > 69) that are not synchronised, nor do they have any kind of associated > lock. The thread safety of the Client is undocumented, but usually Client > classes can assumed to be thread safe. > > These instance variables are used further down in the class in > unsynchronized blocks, meaning that were more than one thread to access > methods that accessed the variables there is a potential race condition. I > was wondering if this is a known issue, a deliberate choice for some > reason, or if the class is not supposed to be used in a multithreaded > manner, and is intended to be used only within ThreadLocal? > > I checked in the master branch of the project and the issue appears to be > present there also. > > Thanks > > Jon >
