private void processSingletonConcurrencyManagementType(BeanMetaData bmd) throws EJBConfigurationException {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();

        if (isTraceOn && tc.isEntryEnabled()) {
            Tr.entry(tc, "processSingletonConcurrencyManagementType");
        }

        // Initialize DD Concurrency Management type to null and change to
        // non null value if it is specified in the DD for the module.
        ConcurrencyManagementType ddType = null;

        // F743-7027 start
        Session sessionBean = (Session) bmd.wccm.enterpriseBean;
        if (sessionBean != null) {
            int type = sessionBean.getConcurrencyManagementTypeValue();
            if (type == Session.CONCURRENCY_MANAGEMENT_TYPE_CONTAINER) {
                ddType = ConcurrencyManagementType.CONTAINER;
            } else if (type == Session.CONCURRENCY_MANAGEMENT_TYPE_BEAN) {
                ddType = ConcurrencyManagementType.BEAN;
            }
        } // F743-7027 end

        // Initialize annotation Concurrency Management type to null and change to
        // non null value only if metadata complete is false and annotation is used
        // for this Singleton session bean.
        ConcurrencyManagementType annotationType = null;
        if (bmd.metadataComplete == false) {
            // Metadata complete is false, so do we have annotation value?
            // Note, EJB spec says annotation can not be inherited from superclass.
            Class<?> ejbClass = bmd.enterpriseBeanClass;
            ConcurrencyManagement annotation = ejbClass.getAnnotation(javax.ejb.ConcurrencyManagement.class);
            if (annotation != null) {
                // We have an annotation on EJB class, so validate that it is a valid value.
                annotationType = annotation.value();
                if (annotationType != ConcurrencyManagementType.CONTAINER && annotationType != ConcurrencyManagementType.BEAN) {
                    // CNTR0193E: The value, {0}, that is specified for the concurrency management type of
                    // the {1} enterprise bean class must be either BEAN or CONTAINER.
                    Tr.error(tc, "SINGLETON_INVALID_CONCURRENCY_MANAGEMENT_CNTR0193E", new Object[] { annotationType, bmd.enterpriseBeanClassName });

                    throw new EJBConfigurationException("CNTR0193E: The value, " + annotationType
                                                        + ", that is specified for the concurrency management type of the "
                                                        + bmd.enterpriseBeanClassName + " enterprise bean class must be either BEAN or CONTAINER.");
                }
            }
        }

        // Assign concurrency management type for this Singleton seesion bean.
        // Note, in "4.8.4.3 Specification of a Concurrency Management Type" of EJB 3.1 specification,
        // it says "The application assembler is not permitted to use the deployment
        // descriptor to override a bean's concurrency management type regardless of whether
        // it has been explicitly specified or defaulted by the Bean Provider."  However,
        // we have no way to know whether DD is from application assembler vs Bean Provider,
        // so we have to assume it came from Bean Provider.  The team decided that if both
        // annotation and DD is used, then the value must match. If they do not match,
        // throw an exception.

        // Was a value provided via DD?
        if (ddType == null) {
            // DD did not provide a value, so use annotation value if one was provided.
            // Otherwise, use default value required by EJB 3.1 spec.
            if (annotationType != null) {
                // No DD, but we have annotation. So use the annotation.
                bmd.ivSingletonUsesBeanManagedConcurrency = (annotationType == ConcurrencyManagementType.BEAN);
            } else {
                // Neither DD nor annotation, so default to Container Concurrency Management type.
                bmd.ivSingletonUsesBeanManagedConcurrency = false;
            }
        } else {
            // DD did provide a concurrency management type. Verify it matches annotation type
            // if both annotation and DD provided a value.
            if (annotationType != null && ddType != annotationType) {
                // CNTR0194E: The value {0} that is specified in the ejb-jar.xml file for concurrency management type is
                // not the same as the @ConcurrencyManagement annotation value {1} on the {2} enterprise bean class.
                Tr.error(tc, "SINGLETON_XML_OVERRIDE_CONCURRENCY_MANAGEMENT_CNTR0194E", new Object[] { ddType, annotationType, bmd.enterpriseBeanClassName });

                throw new EJBConfigurationException("CNTR0194E: The value " + ddType
                                                    + " that is specified in the ejb-jar.xml file for concurrency management type is not the same "
                                                    + " as the @ConcurrencyManagement annotation value " + annotationType + " on the "
                                                    + bmd.enterpriseBeanClassName + " enterprise bean class.");
            }

            // Use DD value since either annotation not used or DD matches the annotation type.
            bmd.ivSingletonUsesBeanManagedConcurrency = (ddType == ConcurrencyManagementType.BEAN);
        }

        if (isTraceOn && tc.isEntryEnabled()) {
            Tr.exit(tc, "processSingletonConcurrencyManagementType returning "
                        + bmd.ivSingletonUsesBeanManagedConcurrency + " for j2ee name = " + bmd.j2eeName);
        }
    }
private void processSingletonConcurrencyManagementType ( BeanMetaData bmd ) throws EJBConfigurationException { final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "processSingletonConcurrencyManagementType" ) ; } ConcurrencyManagementType ddType = null ; Session sessionBean = ( Session ) bmd . wccm . enterpriseBean ; if ( sessionBean != null ) { int type = sessionBean . getConcurrencyManagementTypeValue ( ) ; if ( type == Session . CONCURRENCY_MANAGEMENT_TYPE_CONTAINER ) { ddType = ConcurrencyManagementType . CONTAINER ; } else if ( type == Session . CONCURRENCY_MANAGEMENT_TYPE_BEAN ) { ddType = ConcurrencyManagementType . BEAN ; } } ConcurrencyManagementType annotationType = null ; if ( bmd . metadataComplete == false ) { Class < ? > ejbClass = bmd . enterpriseBeanClass ; ConcurrencyManagement annotation = ejbClass . getAnnotation ( javax . ejb . ConcurrencyManagement . class ) ; if ( annotation != null ) { annotationType = annotation . value ( ) ; if ( annotationType != ConcurrencyManagementType . CONTAINER && annotationType != ConcurrencyManagementType . BEAN ) { Tr . error ( tc , "SINGLETON_INVALID_CONCURRENCY_MANAGEMENT_CNTR0193E" , new Object [ ] { annotationType , bmd . enterpriseBeanClassName } ) ; throw new EJBConfigurationException ( "CNTR0193E: The value, " + annotationType + ", that is specified for the concurrency management type of the " + bmd . enterpriseBeanClassName + " enterprise bean class must be either BEAN or CONTAINER." ) ; } } } if ( ddType == null ) { if ( annotationType != null ) { bmd . ivSingletonUsesBeanManagedConcurrency = ( annotationType == ConcurrencyManagementType . BEAN ) ; } else { bmd . ivSingletonUsesBeanManagedConcurrency = false ; } } else { if ( annotationType != null && ddType != annotationType ) { Tr . error ( tc , "SINGLETON_XML_OVERRIDE_CONCURRENCY_MANAGEMENT_CNTR0194E" , new Object [ ] { ddType , annotationType , bmd . enterpriseBeanClassName } ) ; throw new EJBConfigurationException ( "CNTR0194E: The value " + ddType + " that is specified in the ejb-jar.xml file for concurrency management type is not the same " + " as the @ConcurrencyManagement annotation value " + annotationType + " on the " + bmd . enterpriseBeanClassName + " enterprise bean class." ) ; } bmd . ivSingletonUsesBeanManagedConcurrency = ( ddType == ConcurrencyManagementType . BEAN ) ; } if ( isTraceOn && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "processSingletonConcurrencyManagementType returning " + bmd . ivSingletonUsesBeanManagedConcurrency + " for j2ee name = " + bmd . j2eeName ) ; } }
F743-1752CodRev rewrote to do error checking and validation.