Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Hibernate Seach lock the sesion
PostPosted: Mon Feb 06, 2012 11:26 am 
Newbie

Joined: Mon Feb 06, 2012 10:53 am
Posts: 9
Hello!

I'm doing an a Web application with struts and hibernate and all works good, but now i want add hibernate search.
I have a problem because i'm using HibernateUtils to generate a session but when i add hibernate Search and I start the application. In the log don't appear any error but when the application wants to get a sesion, apparently, the application is blocked.
Debuging this case I can see that the code stops when each dao of application try to get the sesion, because (i think) hibernate seach has this sesion.

Some idea?
Thanks and sorry for my english.


Top
 Profile  
 
 Post subject: Re: Hibernate Seach lock the sesion
PostPosted: Wed Feb 08, 2012 7:24 am 
Newbie

Joined: Mon Feb 06, 2012 10:53 am
Posts: 9
It was the size of the pool. I'm using org.hibernate.connection.C3P0ConnectionProvider and if I set a size less than 15, the indexer doesn't end the process.

is there any form to start correctly the application with a less pool size?

Thanks !


Top
 Profile  
 
 Post subject: Re: Hibernate Seach lock the sesion
PostPosted: Wed Feb 08, 2012 12:48 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2296
Location: Third rock from the Sun
Hi,
Hibernate Search should not use any additional connection. The only known case is when you have it use the MassIndexer, in that case it will need a lot of connections, depending on how many threads you have started it with and how many indexed types you have.

https://hibernate.onjira.com/browse/HSEARCH-598

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


Top
 Profile  
 
 Post subject: Re: Hibernate Seach lock the sesion
PostPosted: Thu Feb 09, 2012 6:13 am 
Newbie

Joined: Mon Feb 06, 2012 10:53 am
Posts: 9
Hi,

Hibernate doesn't use any additional connection, but I'm using the MassIndexer and it needs a big pool, but I haven't so connections.
If this size of pool size is mandatory, this will be a problem for me, because I only have 10 connections.

I'm trying to configure the MassIndexer when it starts to see if with a configuration is able to start with a pool size of 10, but I don't find it.
Code:
   massIndex.purgeAllOnStart(true) // true by default, highly recommended
            .threadsForIndexWriter(7)
            .batchSizeToLoadObjects( 25 )
            .threadsToLoadObjects( 5 )
            .threadsForSubsequentFetching( 10 )
            .startAndWait();


Top
 Profile  
 
 Post subject: Re: Hibernate Seach lock the sesion
PostPosted: Thu Feb 09, 2012 6:27 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2296
Location: Third rock from the Sun
The issue I mentioned in previous post is just meant to make this configuration easier, but it's possible even with current version.

Here is a workaround:

threadsForSubsequentFetching + threadsToLoadObjects + 1 = number of connections needed for each indexed entity

So you have to
1) pick a lower amount of threads especially for the two options mentioned above.
2) Index one entity type at a time.

Code:
fullTextSession.createIndexer( EntityA.class ).batchSizeToLoadObjects( 25 ).threadsToLoadObjects( 3 ).threadsForSubsequentFetching( 5 ).threadsForIndexWriter( 2 ).startAndWait();
fullTextSession.createIndexer( EntityB.class ).batchSizeToLoadObjects( 25 ).threadsToLoadObjects( 3 ).threadsForSubsequentFetching( 5 ).threadsForIndexWriter( 2 ).startAndWait();
//... other entities, doing it in series instead of in parallel

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


Top
 Profile  
 
 Post subject: Re: Hibernate Seach lock the sesion
PostPosted: Thu Feb 09, 2012 6:47 am 
Newbie

Joined: Mon Feb 06, 2012 10:53 am
Posts: 9
Hi,

I have just tried and works fine.

Thanks so much for your answer.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 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.