2 Replies Latest reply: Jul 22, 2009 5:42 PM by Anonymous Anonymous RSS

Can't get use-try-lock to work

John Fruncek Newbie

We've got an app that makes several queries. Intermittantly, it will fail with an error like:

Unable to obtain lock in 60 seconds: org.jboss.resource.adapter.jdbc.local.LocalManagedConnection@1478101


I've been able to track this down to:
BaseWrapperManagedConnectionFactory.useTryLock, which defaults to 60, thus the 60 seconds.

However, there doesn't seem to be any way to set this value in the datasource configuration. The dtd for datasources talks about use-try-lock, but it never appears to be getting set (based on debugging)

How do I configure this value? Moreover, why do I need to (i.e. why would I be getting the error in the first place).

  • 1. Re: Can't get use-try-lock to work
    John Fruncek Newbie

    Further update: First, this is for jboss-5.0.1.GA.
    Second:
    This seems to be an incompatibility in a configuration attribute type. In initializing the datasource, the class LocalManagedConnectionFactory is being used. This extends BaseWrapperManagedConnectionFactory, which has a method

     public void setUseTryLock(int useTryLock)
    

    This would be set by ManagedConnectionFactoryDeployment.setManagedConnectionFactoryAttribute().

    I believe the value is coming from DataSourceDeploymentMetaData:
     @ManagementProperty(name="use-try-lock", description="The internal lock timeout",
     includeInTemplate=true)
     public long getUseTryLock()
    


    However, the setter takes an int. The property is defined as a long. The reflection in the method that sets it is looking for something that takes a long, and does not find it. It logs it as a trace, since its not required to be there, so no warning is indicated. In short, there doesn't seem to be a way to configure the use-try-lock timeout.