-->
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: Why is the thread be blocked? about session.
PostPosted: Sat Jul 02, 2005 6:22 am 
Newbie

Joined: Sat Jul 02, 2005 4:29 am
Posts: 2
hi, all
there is a timer in my program, and it does same database operations periodly. Everytime, it creates a new session, does some operations, then closes the session. The code likes this:

Session session = null;
try
{
session = sessionFactory.openSession();
...
session.save(obj);
session.flush();
session.connection().commit();
...

session.close();
}
catch(...)

When it is doing these operations, I cut off the connection with the database. The thread of the timer will be blocked without any exception thrown. So, the timer is "dead". Adding some log, I find the blocking takes place in save or commit. How can I deal with it?

I use SQL-SERVER2000 and dbcp connection pool. This is some configuration:
<session-factory>
<property name="show_sql">true</property>
<!-- properties for this SessionFactory only -->
<property name="hibernate.connection.driver_class">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
<property name="hibernate.connection.url">jdbc:microsoft:sqlserver://...</property>
<property name="hibernate.connection.username">..</property>
<property name="hibernate.connection.password">..</property>
<property name="dialect">net.sf.hibernate.dialect.SQLServerDialect</property>

<property name="hibernate.dbcp.maxActive">100</property>
<property name="hibernate.dbcp.whenExhaustedAction">1</property>
<property name="hibernate.dbcp.maxWait">120000</property>
<property name="hibernate.dbcp.maxIdle">10</property>

<property name="hibernate.dbcp.ps.maxActive">100</property>
<property name="hibernate.dbcp.ps.whenExhaustedAction">1</property>
<property name="hibernate.dbcp.ps.maxWait">120000</property>
<property name="hibernate.dbcp.ps.maxIdle">100</property>

<property name="hibernate.cache.provider_class">net.sf.ehcache.hibernate.Provider</property>


<!-- mapping files -->
<mapping resource="com/zte/zxpcs/glc/persist/Authentication.hbm.xml"/>
</session-factory>


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 02, 2005 6:38 am 
Newbie

Joined: Sat Jul 02, 2005 4:29 am
Posts: 2
I see some posters about DBCP, if the problem is related with DBCP?
And I read some posters about session timeout. It seems there is no session timeout in hibernate now? Why?


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.