rmuir commented on PR #11998:
URL: https://github.com/apache/lucene/pull/11998#issuecomment-1454871129

   This was done on purpose as there's no such guarantee on `Terms` instances. 
Of particular concern are the ones returned back from `TermVectors` class. 
   
   You can see above in the iterations on this PR that we beefed up 
thread-confinement tests and documentation for both `StoredFields` and 
`TermVectors`: these data structures were always thread-confined before by 
`ThreadLocal` variables. Now it is on the user and (unfortunately) it opens up 
the possibility of mistakes. 
   
   We no longer "hand-hold" users with `ThreadLocal` variables, but at the same 
time, it allows for large memory reduction for applications that don't need 
them.
   
   I don't think MultiTerms/Terms should be accessed by multiple threads 
either, there's no guarantee that here, that there isnt some unsafe publishing 
of variables updated or something like that: please don't cache them. If you 
insist on caching them, maybe consider using your own ThreadLocal for that 
purpose.
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to