db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Monroe" <Greg.Mon...@DukeCE.com>
Subject RE: ClassLoader Exception
Date Thu, 09 Mar 2006 17:34:21 GMT
Ultimately, Torque just uses the standard JDBC driver Connection 
transaction methods ( autocommit(false), commit(), etc. ).  All
this is wrapped up in the util.Transactions class which simply 
checks to see if the DB/driver support them.

The Torque peer methods all wrap all the individual SQL statement
executions (update, insert, delete, and the like) in a transaction.

If the application needs multiple statement transaction protection, 
then you can use the Transaction class methods to get a "transaction
protected" connection, pass this to the methods with a Connection as
a parameter to do the multiple statements, then use the Transaction
class to commit it (and wrap the whole process in a check for errors
and rollback block).

FWIW, I've run load tests with a Torque based application that had
400 "frantic" users hitting the site with an average of 30 
requests/second.  Each request had at least one Torque DB request 
(many had more).  There were no transaction or other blips with 
this (in fact the pooling mechanism did a great job of keeping the
number of open DB connections down...)

One other possible reason for your problem is the need to change your
MySQL server setting.  I seem to remember there are some properties 
that can effect the number of times a single DB user can connect 
simultaneously.  Your IO errors might be occuring because the DB is
refusing the Nth connection from your application DB user id.

If you are using Torque's connection pooling factory, you can 
control the number of open connections with various 
torque.properties settings.  See the docs about the 
torque.dsfactory.* properties.

Finally, it might be related to a pooled connection's socket 
level connection to the server timing out.  Torque has a 
couple of properties:

torque.dsfactory.default.pool.testOnBorrow=true
torque.dsfactory.default.pool.validationQuery=SELECT 1

which help with this.  The first tells the pooling system to
test the Socket level connection before your code get it.  The
second is the actual query used to do this.  If the query fails,
a new connection object is created and passed to your code.  The
errors are "hidden" from the higher level code.

Good luck.


> -----Original Message-----
> From: Matteo Barbieri [mailto:m.barbieri@ste-energy.com] 
> Sent: Thursday, March 09, 2006 11:12 AM
> To: Apache Torque Users List
> Subject: Re: ClassLoader Exception
> 
> 
> Thomas Fischer ha scritto:
> 
> >This does not seem to be a problem of Torque.
> >A general advice would be to check the places where the mysql driver 
> >classes are loaded from. Make sure that for each application, the 
> >driver can be loaded only from one place.
> >
> >   Thomas
> >  
> >
> After more investigation I found that this problem could be 
> caused by the interaction of Torque and another library I use 
> (ZK). To better understanding the problem I would like to 
> know how Torque creates and closes transactions. If you can 
> tell me something or point me to the right source code, thank you.
> 
> Bye
> 
> -- 
> Matteo Barbieri
> S.T.E. s.r.l.
> m.barbieri@ste-energy.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are confidential communication
or may otherwise be privileged or confidential and are intended solely for the individual
or entity to whom they are addressed.  If you are not the intended recipient you may not rely
on the contents of this email or any attachments, and we ask that you  please not read, copy
or retransmit this communication, but reply to the sender and destroy the email, its contents,
and all copies thereof immediately.  Any unauthorized dissemination, distribution or copying
of this communication is strictly prohibited.



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message