|
From: <tho...@tr...> - 2005-02-22 17:13:24
|
I think it makes sense to have DeadlockLoserDataAccessException being a subclass
of ConcurrencyFailureException. Then you would only have to catch this
exception before retrying the operation.
The esiest way to handle this in the translation is to set the
"customTranslations" property on the "SQLErrorCodes" like:
<bean id="Sybase" class="org.springframework.jdbc.support.SQLErrorCodes">
...
<property name="badSqlGrammarCodes">
...
</property>
<property name="dataIntegrityViolationCodes">
...
</property>
...
<property name="customTranslations">
<list>
<bean
class="org.springframework.jdbc.support.CustomSQLErrorCodesTranslation">
<property name="errorCodes">
<value>1205</value></property>
<property name="exceptionClass">
<value>org.springframework.dao.DeadlockLoserDataAccessException</value>
</property>
</bean>
</list>
</property>
...
</bean>
Thomas
Quoting Pierre Bittner <pie...@gm...>:
> Hi Juergen,
>
> In our project, we use an implementation of SQLExceptionTranslator to
> translate sybase error code '1205' in
> DeadlockLoserDataAccessException.
>
> >From sybase documentation:
>
> "This error occurs when a process tries to acquire a lock on an object
> that is locked by a second process when the second process is waiting
> for a lock on an object that has been locked by the first process.
> This situation is a deadlock, and can involve more than two processes.
>
> Adaptive Server detects this situation, rolls back the transaction
> that has accumulated the least amount of CPU time, and notifies the
> application program of this action with Error 1205. This allows the
> other users' processes to move forward."
>
> We catch the DeadlockLoserDataAccessException in an ExceptionHandler
> and display a warning to user.
>
> Hope this helps.
>
> Pierre
>
> On Tue, 22 Feb 2005 13:12:23 +0100, Juergen Hoeller
> <ju...@in...> wrote:
> > Thomas, everybody,
> >
> > Please have a look at the following JIRA issue:
> > http://opensource.atlassian.com/projects/spring/browse/SPR-733
> >
> > I agree that DeadlockLoserDataAccessException should be a subclass of
> > ConcurrencyFailureException (which has been introduced in Spring 1.1), and
> > have already changed this locally.
> >
> > However, DeadlockLoserDataAccessException isn't thrown anywhere;
> > SQLErrorCodes does not support it. So as indicated in SPR-733, should we
> > generally throw CannotAcquireLockException in such a case (which currently
> > seems to happen for some databases, as defined in sql-error-codes.xml)?
> > What's the semantic difference between those two exceptions, and is it
> worth
> > keeping both?
> >
> > Juergen
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
|