6 Replies Latest reply on Aug 11, 2016 6:09 AM by tomjenkinson

    Proper way of suspending transaction after the timeout


      Lets suppose we are using remote client that is invoking stateful session bean A using iiop interface. Transactions in A are container managed.

      So we have:


      A a = lookupBean();



      Now let's suppose that there was a timeout during foo invocation. Rollback exception is being catched but the transaction has been not suspended. After such situation there is still the ControlWrapper object associated with the thread on the server. As a result if later we are trying to perform the same operation once again we can face corba's NameNotFound exception during InterpositionClientRequestInterceptorImpl operation - the interceptor looks for the ControlWrapper - it can find it so it looks for the transaction but hence transaction is not present the error occurs. If we want to disassociate the transaction with the thread, we have to suspend the transaction using TransactionManager's suspend method - if transaction is suspended then indeed the ControlWrapper becomes dissassociated with thread and the next transactions work correctly. To my understanding we should take this into consideration during each bean invocation. What is a good practice of doing that?