1 of 1 people found this helpful
when opening an IndexWriter on any Directory implementation is implicitly acquires an exclusive Lock.
So if you try opening an IndexWriter on both nodes at the same time, you won't corrupt the index but one of the two nodes will succeed and the other will likely see a timeout exception.
If your application doesn't open IndexWriters very often, you might have the code just try and hope for the best, eventually retrying; but it's of course better and less tricky if you can configure your application in such a way that only one of the two nodes ever attempts to write to the index.
For example Infinispan Query uses the Hibernate Search engine to delegate writes to a remote node; the options there are to use JMS or JGroups to forward needs to write to a specific node.
I'd suggest to have a look in this chapter: http://docs.jboss.org/hibernate/search/4.2/reference/en-US/html_single/#d0e652
thank you for your answer.
I think it will help me to understand what should I do as next.