Announcement Announcement Module
No announcement yet.
Deadlock Handling in Spring Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Deadlock Handling in Spring

    Hi all,

    I am developing a flex application with spring as backend. IBM DB2 is my database. Can anybody guide me how to handle deadlocks in this scenario? I am using iBatis to connect to DB.

    Thanks in Advance,


  • #2
    Deadlocks of what?

    - Database
    - Threads


    • #3
      oops!! sorry... deadlocks of database..


      • #4
        This is task of the database. It would be impossible to handle for Spring because if there is another application talking to the database, Spring has no way of knowing which records the other application is locking.

        In most cases some kind of deadlock detection is used inside the database. But eventually a connection timeout is going to save you from a deadlock anyway

        The DeadlockLoserDataAccessException can be thrown by Spring when it figures out that the database has rolled back the transaction. It is a subclass of the DataAccessException, so you don't need to deal with it in most cases.

        In most cases dealing with deadlocks in the database is not something you need to worry about (unlike deadlocks with Java objects).

        If you see a lot of DeadlockLoserDataAccessExceptions in your logfiles, it would be time to resolve to issue in a more explicit manner.
        Last edited by Alarmnummer; Jun 13th, 2008, 08:42 AM.


        • #5
          You could wrap your iBatis DAO in a ProxyFactory bean and add a RetryInterceptor. You would also need to add some sort of exception transaction to indicate which exceptions are going to be retried. Take a look at this thread