2 Replies Latest reply on Jan 4, 2013 3:35 AM by Vova Kurilow

    InfinispanDirectory, two Cluster

    Vova Kurilow Newbie

      Hello together,

       

      I use Lucene with InfinispanDirectory because we have two mashines and we need to bind them in a cluster.

       

      in documentation of Infinispan I found following limitation:

      "As when using an IndexWriter on a filesystem based Directory, even on the clustered edition only one IndexWriter can be opened across the whole cluster."

      https://docs.jboss.org/author/display/ISPN/Infinispan+as+a+Directory+for+Lucene

       

      If I have the same application on two or more nodes, how can I know that the IndexWriter is already opened on other node???

       

      my code is:

      EmbeddedCacheManager manager = new DefaultCacheManager("infinispan.xml");

      Cache<Object, Object> cache = manager.getCache("customerIndexerCache");

       

      customerIndexDirectory = new InfinispanDirectory(cache, "customerIndex");

      writer = new IndexWriter(customerIndexDirectory, config);

       

      My infinispan.xml has following cache entry:

         <namedCache name="customerIndexerCache">

            <clustering mode="replication" />

         </namedCache>

       

      when I execute this code on two nodes, then I make

              writer = new IndexWriter(customerIndexDirectory, config);

      on two nodes.

       

      Both nodes take data from the same source and will try to create lucene documents and add to the writer. Should I avoid it somehow in my source, or does infinispanDirectory it for me?

       

       

      thank you for your answer.