结构: Simple
Abstraction: Variant
状态: Draft
被利用可能性: unkown
The program violates the Enterprise JavaBeans (EJB) specification by using thread synchronization primitives.
The Enterprise JavaBeans specification requires that every bean provider follow a set of programming guidelines designed to ensure that the bean will be portable and behave consistently in any EJB container. In this case, the program violates the following EJB guideline: "An enterprise bean must not use thread synchronization primitives to synchronize execution of multiple instances." The specification justifies this requirement in the following way: "This rule is required to ensure consistent runtime semantics because while some EJB containers may use a single JVM to execute all enterprise bean's instances, others may distribute the instances across multiple JVMs."
cwe_Nature: ChildOf cwe_CWE_ID: 695 cwe_View_ID: 1000
cwe_Nature: ChildOf cwe_CWE_ID: 695 cwe_View_ID: 699
cwe_Nature: ChildOf cwe_CWE_ID: 821 cwe_View_ID: 1000 cwe_Ordinal: Primary
cwe_Nature: ChildOf cwe_CWE_ID: 821 cwe_View_ID: 699 cwe_Ordinal: Primary
Language: {'cwe_Name': 'Java', 'cwe_Prevalence': 'Undetermined'}
范围 | 影响 | 注释 |
---|---|---|
Other | Quality Degradation |
策略:
Do not use Synchronization Primitives when writing EJBs.
In the following Java example a Customer Entity EJB provides access to customer information in a database for a business application.
bad Java
However, the customer entity EJB uses the synchronized keyword for the set methods to attempt to provide thread safe synchronization for the member variables. The use of synchronized methods violate the restriction of the EJB specification against the use synchronization primitives within EJBs. Using synchronization primitives may cause inconsistent behavior of the EJB when used within different EJB containers.
映射的分类名 | ImNode ID | Fit | Mapped Node Name |
---|---|---|---|
Software Fault Patterns | SFP3 | Use of an improper API |