Reputation: 55
Provided I want to read from the same IndexReader instance,presumably a singleton instance,from multiple threads how that would affect to the performance?Will there be "read lock" or anything that could potentially harm the possibility of multi threading?
Is there any best practise to use same IndexReader in multi threading environment?
Upvotes: 0
Views: 1607
Reputation: 2583
According to the documentation,
IndexReader instances are completely thread safe, meaning multiple threads can call any
of its methods, concurrently. If your application requires external synchronization,
you should not synchronize on the IndexReader instance; use your own (non-Lucene)
objects instead.
But another thing you would like to consider is , if the indexreader is shared by multiple threads and in that process the index gets updated, the updated index wont get reflected until you create a new indexreader instance.
Upvotes: 2