Hi ,

   i'm using SolrJ to do some indexing work with CloudSolrServer class. It's
strange that when i start several threads (each thread add 10000 documents)
to add documents,  the result is just only 10000 can be indexed finally. But
if i change the thread num as 1, everything is ok. Even if  it's same as i
start seveval processes at same time.

   i use solr 4.6.0.

   Here is some code:

public class SolrUpdater implements Runnable {
        private final UpdateRequest req = new UpdateRequest();
        private final CloudSolrServer solr;
        private final AtomicLong id;

        public SolrUpdater(CloudSolrServer solr, AtomicLong id) {
                this.solr = solr;
                this.id = id;
        }

        @Override
        public void run() {
                List<SolrInputDocument> docList = buildDocList();
                System.out.println(String.format("Start to send updater%d", 
id.get()));
                long start = System.currentTimeMillis();

                        try {
                                UpdateResponse rep = solr.add(docList);
                                System.out.println(rep.toString());
                        } catch (SolrServerException e) {
                                e.printStackTrace();
                        } catch (IOException e) {
                                e.printStackTrace();
                        }
                
                long end = System.currentTimeMillis();
                System.out.println(String.format("End to send updater%d, time 
is [%d]",
id.get(), end - start));
        }
}



--
View this message in context: 
http://lucene.472066.n3.nabble.com/CloudSolrServer-has-thread-safe-issue-tp4112423.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to