cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Malcolm Edgar <malcolm.ed...@gmail.com>
Subject Re: JDBC Statement Timeout
Date Wed, 15 Oct 2014 02:38:26 GMT
Hi Guys,

I ended up wrapping the JNDIDataSourceFactory, DataSource and Connection
classes and configuring this in the domain configuration file. The wrapped
Connection class sets the queryTimeout when the Statement objects are
created.

<node name="formcenterNode-JNDI"
 factory="com.avoka.core.cayenne.CoreJNDIDataSourceFactory"
 parameters="java:/FormCenterDS">
<map-ref name="formcenterMap"/>
</node>

This flushed out the errors, which we are now working to resolved.

Couple of thoughts on this: it would be nice to be able to set the
queryTimeout on the SelectQuery class, as this would give you more fine
grained control over the execution of statements, rather than having a
global setting with what we are doing above.

I think probably the better solution for this problem would be for me to
use a better Connection pool which will release blocked connections, and
allow the database to kill the sessions which are causing deadlocks. The
connection pool in JBoss 7.0.2 is pretty basic.

Are there any 3rd party connection pools you would recommend for OLTP
production usage?

thanks Malcolm Edgar




On Wed, Oct 15, 2014 at 10:40 AM, Andrus Adamchik <andrus@objectstyle.org>
wrote:

> Yep, that's one way of doing it, though requiring to use a custom query
> everywhere. A DI alternative of the same solution is to do something like
> this in a custom Module:
>
>   binder.bind(OracleSniffer.class).to(MyOracleSniffer.class);
>
> MyOracleSniffer would implement DbAdapterDetector which is a decorator of
> OracleSniffer. It will return a DbAdapter decorator of the OracleAdapter,
> overriding DbAdapter.getAction(..) to set timeouts.
>
> And yes, we need a better way to do this. But at least this one is
> non-invasive in that it doesn't require you to change idiomatic Cayenne
> code elsewhere.
>
> Andrus
>
>
>
> On Oct 13, 2014, at 3:00 PM, Emanuele Maiarelli <
> maiarelli.emanuele@gmail.com> wrote:
> > http://cayenne.195.n3.nabble.com/query-timeout-needed-td1070.html
> >
> > The link explains the solution for cayenne 1.2.
> >
> > You can try with cayenne 3.1 being aware that packages named
> > org.objectstyle.* have been renamed as org.apache.*
> >
> >
> >
> > 2014-10-13 4:50 GMT+02:00 Malcolm Edgar <malcolm.edgar@gmail.com>:
> >
> >> Hi All,
> >>
> >> I am having some deadlock issues with the Oracle database, and want to
> be
> >> able to set the JDBC statement timeout.
> >>
> >> From what I understand this isn't supported in Cayenne 3.1, and I am
> after
> >> advice on the best way to do this in a Cayenne context.
> >>
> >>
> >>
> http://docs.oracle.com/javase/6/docs/api/java/sql/Statement.html#setQueryTimeout%28int%29
> >>
> >> Thanks in advance for any help.
> >>
> >> regards Malcolm Edgar
> >>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message