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

Allow a ServiceRequest to be annotated as read only

    Details

      Description

      The RequestType attribute on the ServiceRequest annotation identifies whether the service request is always read only as far as transactional modifications are concerned or, alternatively, that it may make changes to transactional data. in the latter case the service request method can indicate a read-only outcome by invoking the readOnly method of an injected control.

      @Retention(RetentionPolicy.RUNTIME)
      @Target(ElementType.METHOD)
      public @interface ServiceRequest
      {
          public RequestType requestType() default RequestType.MODIFY;
      }
      

      The framework does not normally register lifecycle callbacks for ServiceRequest methods whose request type is READ_ONLY (see the next paragraph for the rider which qualifies this statement). The framework does normally register callbacks for ServiceRequest methods whose request type is MODIFY, on the assumption that the method has performed transactional changes. The latter methods may inhibit registration of lifecycle methods by calling the readOnly() method of an injected transaction control.

      The reason why it is important to identify READ_ONLY methods is that they affect the way the framework performs PREPARE or COMPLETE processing (as appropriate to the protocol in question). If all ServiceRequest methods in the transaction are READ_ONLY the participant will trigger READ_ONLY or EXIT callbacks, respectively, for these lifecycle events, precluding further involvement in the transaction. If any of the ServiceRequest methods is not READ_ONLY then the framework will trigger PREPARE or COMPLETE callbacks, respectively. Clearly, it would be futile for a READ_ONLY declaration or notification to inhibit registration of callbacks which are triggered by READ_ONLY or EXIT events. So, the framework only registers READ_ONLY or EXIT lifecycle callbacks when they are triggered by READ_ONLY methods or by MODIFY methods which notify their READ_ONLY status using an injected control.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  paul.robinson Paul Robinson
                  Reporter:
                  paul.robinson Paul Robinson
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: