Uploaded image for project: 'JBoss Transaction Manager'
  1. JBoss Transaction Manager
  2. JBTM-977

Specify the order in which lifecycle methods are invoked when multiple of the same type exist

    XMLWordPrintable

Details

    Description

      The 'order' attribute on Lifecycle callback annotations (e.g. @Compensate, @Prepare) can be used to ensure that certain lifecycle callbacks precede others during lifecycle processing. Normally, callbacks are made in the reverse order to that in which their corresponding service request was made. FIRST indicates that the callback should be executed before other NORMAL callbacks registered for the same lifecycle event. LAST indicates that the callback should be executed after other NORMAL callbacks registered for the same lifecycle event. Multiple FIRST or LAST callbacks are sorted in reverse order of registration.

      Example:

      @ServiceRequest()
      public void submitOrder(...)
      {
        ...
      }
      
      @Compensate
      public void cancelOrder()
      {
        //Cancel the order
      }
      
      @Compensate(order=ExecutionOrder.LAST)
      public void notifyAdmin()
      {
        //Notify an admin that an order was cancelled. 
      }
      

      Attachments

        Activity

          People

            paul.robinson@redhat.com Paul Robinson
            paul.robinson@redhat.com Paul Robinson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: