-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: MassIndexer doesn't stop after indexingCompleted
PostPosted: Mon Feb 13, 2012 6:17 am 
Newbie

Joined: Mon Feb 13, 2012 6:09 am
Posts: 1
Hello,
I am trying to build index with the following code:

Code:
      SimpleIndexingProgressMonitor sipm = new SimpleIndexingProgressMonitor(){
         @Override
         public void entitiesLoaded(int size) {
            super.entitiesLoaded(size);
            log.debug("Entities loaded: " + size);
         }

         @Override
         public void indexingCompleted() {
            super.indexingCompleted();
            log.debug("Indexing finished.");
         }
      };

      MassIndexer massIndexer = fullTextEntityManager.createIndexer(ReceptIndex.class)
         .batchSizeToLoadObjects(1000)
         .threadsForSubsequentFetching(8)
         .threadsToLoadObjects(4)
         .threadsForIndexWriter(3)
         .cacheMode(CacheMode.IGNORE)
         .progressMonitor(sipm)
         .optimizeOnFinish(true);

      massIndexer.startAndWait();


Everything works fine, but after the aplication returns from the method, some threads are probably still running in the background.
If I don't manually kill the application and try to build index again, I get exception because of the lock that is obtained for this index.

I would like to know, how to stop MassIndexer threads when indexing is completed. Am I missing something? If you need more details or code, I will post it.


Top
 Profile  
 
 Post subject: Re: MassIndexer doesn't stop after indexingCompleted
PostPosted: Thu Mar 08, 2012 8:07 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi rokd,
there should be no threads working in the background after the startAndWait() returns, you have likely run in some issue.

One thing makes me suspicios, you talk about "application". So you expect the JVM to shutdown after this?
Make sure you close the SessionFactory to have it terminate internal workers.

If you're closing the SessionFactory correctly, please post a threaddump and the versions you're using I'll have a look.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.