@ Override public boolean isDeliveryTransacted ( Method method ) throws NoSuchMethodException { BeanMetaData bmd = super . beanMetaData ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "MEF.isDeliveryTransacted called for " + bmd . enterpriseBeanName + "." + method . getName ( ) ) ; } /* * Get EJBMethodInfo object for the specified method. */ EJBMethodInfoImpl minfo = getEJBMethodInfo ( method ) ; if ( minfo == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "MEF.isDeliveryTransacted failed to find method " + bmd . enterpriseBeanName + "." + method . getName ( ) ) ; } // CNTR0085E: MDB {0} must implement method {1} of interface {2}. Tr . error ( tc , "NO_SUCH_MDB_METHOD_CNTR0085E" , bmd . j2eeName , method . getName ( ) , bmd . localInterfaceClass ) ; throw new NoSuchMethodException ( bmd . enterpriseBeanName + "." + method . getName ( ) + " not found" ) ; } /* * Use EJBMethodInfo object to determine if transacted or not. * The assumption is true is returned only for TX_REQUIRED and * false is returned for both BMT and TX_NOT_SUPPORTED. */ EJBTransactionAttribute txAttr = minfo . getEJBTransactionAttribute ( ) ; //TransactionAttribute txAttr = minfo.getTransactionAttribute(); boolean transacted ; if ( txAttr == EJBTransactionAttribute . REQUIRED ) { transacted = true ; } else if ( txAttr == EJBTransactionAttribute . NOT_SUPPORTED ) { transacted = false ; } else if ( txAttr == EJBTransactionAttribute . BEAN_MANAGED ) { // JCA 1.5 only addresses CMT. Our guess is BMT // should return false. Would be nice to have a // clarification to JCA spec regarding this case. transacted = false ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "MEF.isDeliveryTransacted detected invalid TX attribute for " + bmd . enterpriseBeanName + "." + method . getName ( ) + ", TX attribute is " + txAttr ) ; } // Something is wrong since we should not have allowed a MDB to be installed // with invalid deployment for transaction attributes. // CNTR0084E: Method {0} of MDB {1} is deployed with an incorrect transaction attribute. Tr . error ( tc , "INVALID_MDB_TX_ATTR_CNTR0084E" , method . getName ( ) , bmd . j2eeName ) ; ResourceException r ; r = new ApplicationServerInternalException ( "Method exists, but TX attribute is neither REQUIRED, NOT_SUPPORTED, nor BEAN_MANAGED: " + txAttr ) ; NoSuchMethodException ex = new NoSuchMethodException ( "see chained exception" ) ; ex . initCause ( r ) ; throw ex ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "MEF.isDeliveryTransacted returning " + transacted + " for " + bmd . enterpriseBeanName + "." + method . getName ( ) ) ; } return transacted ; }
This is used to find out whether message deliveries to a message endpoint will be transacted or not . The message delivery preferences must not change during the lifetime of a message endpoint . This information is only a hint and may be useful to perform optimizations on message delivery .