Kevin,

the lock timeout is configurable as per

JDO.setLockTimeout(int)

Or do I misunderstand your statement ?

Regards
Werner

PS There's non hard-coded timeout value, just a default of 10 seconds (as
defined in JDO.java).

On Friday 08 August 2003 15:48, Lanaghan, Kevin wrote:
> Werner,  I agree there should be a configurable timeout similar to what you
> have in ejb's.  Is there a hard coded timeout in castor of 14 seconds. 
> Thought I heard that a few months ago.
>
>
>
> -----Original Message-----
> From: Werner Guttmann [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 08, 2003 5:11 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [castor-dev] Timout on Executing Query needed
>
>
> Steffen,
>
> please see inline for questions ...
>
> Werner
>
> On Thursday 07 August 2003 14:53, Schlachter, Steffen (LDS) wrote:
> > Werner,
> >
> > here are the tings you requested:
> >
> > a) The mapping file:
> > <?xml version="1.0"?>
> > <mapping>
> > <class name="de.nrw.lds.tipi.kleika.jdo.Dea_Adresse_jdo"
> > identity="adr_id ...">
> > <cache-type type="none"/>
> > <map-to table="t15_adresse" />
> > <field name="adr_id" type="integer">
> > <sql name="adr_id" type="integer" />
> > </field>
> > <field name="adr_name1" type="string">
> > <sql name="adr_name1" type="varchar" />
> > </field>
> > ...
> > </class>
> > </mapping>
> >
> > b) the database.xml file
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <jndi name="java:comp/env/jdbc/deaDB" />
> > <mapping href="t15_adresse_mapping.xml" />
> > ...
> > </database>
> > c) the class that executes the method (sorry, no junit available yet)
> >
> > public ResArrDea_Adresse getAllDea_Adresse(ReqStandard req) {
> > ...
> > db = CastorHelper.getDatabase(getClass());
> >
> > OQLQuery oql;
> > QueryResults results;
> >
> > db.begin();
> >
> > oql = db.getOQLQuery(
> > "SELECT a FROM de.nrw.lds.tipi.kleika.jdo.Dea_Adresse_jdo a WHERE
> > adr_version = $1 and herkunft = $2");
> > oql.bind(Globals.OBJEKT_VERSION);
> > oql.bind(Globals.ANWENDUNG + "_" + req.getKennung());
> > results = oql.execute(Database.ReadOnly);
> > ...
> > }
> > results.close();
> > oql.close();
> > db.commit();
> > }
> > catch (Exception e) {
> > ...
> > }
> > }
> > finally {
> > try {
> > db.close();
> > }
> > ...
> > }
> > ...
> > return resp;
> > }
> >
> > d) we haven't got a schema
> >
> > e) The setting is as follow:
> >
> > Database CA Ingres 2.6
> > JVM version 1.4.2
> > The code above is the server side application of a WebService using Axis
> > 1.1
> >
> > The problem:
> > Whenever anyone changes the database and forgets to execute commit Ingres
> > will lock the whole table, i.e. noone else can execute another command
> > (as soon as you type in commit, the execution continues).
>
> Are you trying to say that developers forget to issue a commit() in their
> code, or that modifications to the database happen externally to Castor and
> that the people executing these modifications sometimes forget to issue a
> commit ?
>
> Speaking of which, does Ingres support row-level locking to sort of
> mitigate this issue ?
>
> > If the table is locked my code is executed up to the
> > oql.execute(Database.ReadOnly); statement and stop. What I would expect
> > is Castor to throw an exception if the request cannot be fulfilled within
> > a certain amount of time (which I would like to specify).
>
> I'll have to dig some code to verify this, but have you ever tried to use
> JDO.setLockTimeout(int) ? Look at below code fragment taken from JDO.java:
>
> /**
> * Sets the lock timeout for this database. Use zero for immediate
> * timeout, an infinite value for no timeout. The timeout is
> * specified in seconds.
> * <p>
> *
> * @param seconds The lock timeout, specified in seconds
> */
> public void setLockTimeout( int seconds )
> {
> _lockTimeout = seconds;
> }
>
> Can you try to set a value of e.g. 10 seconds and see what happens ?
>
> What confuses me a bit is the fact that OQLQuery.execute (..) doesnot throw
> a LockNotGrantedException whereas Database.load() does. Maybe somebody else
> can comment on this ?
>
> Other than this, let me have a look at some code to get an idea as to why
> using Database.ReadOnly does not have an effect.
>
> > In the java.sql.Statement interface there is a method
> > <file:///G:/P-232-TIPI/TIPI/seu/Docs/j2sdk-1_4_1-doc/docs/api/java/sql/St
> >at ement .html#setQueryTimeout(int)> setQueryTimeout(int seconds) which
> > specifies the time a driver will wait to execute a query before it throws
> > an exception. A brief look at the Castor source code showed that the
> > query timeout is not set anywhere. Apparently there is only a lock
> > timeout that can be set which seems to have no effect on my issue.
> >
> > It would be great if you would have a solution for that.
> >
> > Regards,
> >
> > Steffen
> >
> >
> >
> > -----Urspr�ngliche Nachricht-----
> > Von: Werner Guttmann [mailto:[EMAIL PROTECTED]
> > Gesendet: Donnerstag, 7. August 2003 13:49
> > An: [EMAIL PROTECTED]
> > Betreff: Re: [castor-dev] Timout on Executing Query needed
> >
> >
> > Steffen,
> >
> > can you please provide a small package that includes amogst other things
> > ...
> >
> > a) a mapping file (mapping.xml)
> > b) a jdo configuration file (database.xml)
> > c) a Java class (preferably a JUnit test case) that executes a test case
> > that demonstrates your problem
> > d) a sql schema (if available)
> > e) a short problem description.
> >
> > and I'll haver a look at this problem. Please do not forget to delete all
> > non-relevant fragments of these files from whatever you supply.
> >
> > Regards
> > Werner
> >
> > --Original Message Text---
> > From: Schlachter, Steffen (LDS)
> > Date: Thu, 7 Aug 2003 09:53:16 +0200
> >
> > Hello,
> >
> > I am working with Castor JDO on a Tomcat application server and I am
> > using Apache Commons DBCP for connection pooling to get a connection to
> > an Ingres database.
> >
> > If a table in the database is locked the code (see below) stops on the
> > oql.execute() statement and waits forever. What I need is a sort of
> > timeout that throws an exception if the request cannot be fulfilled
> > within a certain time.
> >
> > Is there any mechanism in Castor JDO that allows me to set a timeout for
> > the required purpose? I believe that the LockTimeout doesn't work as my
> > requests are read-only. I'm looking for something like the
> > setQueryTimeout() in java.sql.Statement interface.
> >
> >
> > jdo = new JDO();
> > jdo.setDatabaseName( "aDatabase" );
> > jdo.setConfiguration( "database.xml" );
> > jdo.setClassLoader( getClass().getClassLoader() );
> >
> > db = jdo.getDatabase();
> > db.begin();
> > oql = db.getOQLQuery("SELECT ...");
> > results = oql.execute(Database.ReadOnly);
> > db.commit();
> > db.close();
> >
> > Thanks for your help,
> >
> > Steffen

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to