2 Replies Latest reply on Jun 10, 2010 7:20 PM by Rachel Hodos

    Optimistic Locking at Join

    Rachel Hodos Novice

      One more question regarding transactions:


      The following looks like a bug to me, from the User Guide:


      "Value exclusive was selected to serialize the executions of        the 2 asynchonous  continuation jobs resulting from the fork. The  respective transactions         that will execute activities ship goods and send  bill will both arrive at the  join.  At the join, both         transactions will synchronize on the same execution (read: update  the  same execution        row in the DB), resulting in a potential  optimistic locking  failure."


      I've seen this in action, where an exception is thrown when I try to execute a forked process.  The only workaround I've seen is to call Thread.sleep() in my driver class after I instantiate the process, where I must cause the thread to sleep until after the join is reached.  However, this obviously requires knowing ahead of time about how long this will take.


      Does anyone know a better way to deal with this? I was thinking there might be a way to use wait/notifyAll, either in the Fork and Join activities, or with the Join activity notifying the main thread in the driver class.


      Any advice would be greatly appreciated.