com.ibm.websphere.ejbcontainer

Interface LightweightLocal



  • public interface LightweightLocal
    Marker interface to indicate that an entity bean should run in 'lightweight local' mode.

    In lightweight local mode, the container streamlines the processing that it performs before and after every method on the bean's local home interface and local business interface. This streamlining can result in improved performance when EntityBean operations are called locally from within an application. Because some processing is skipped when running in lightweight local mode, it can only be used in certain scenarios.

    Note: Enabling this option results in behavior not compliant with the official EJB specification.

    Lightweight local mode is patterned somewhat after the 'Plain Old Java Object' (POJO) Entity model introduced in the EJB 3.0 specification. Using lightweight local mode, you can obtain some of the performance advantages of the POJO Entity model without having to convert your existing EJB 2.x application code to the new POJO model. Subject to the conditions below, lightweight local mode may be applied to both container-managed persistence (CMP) and bean-managed persistence (BMP) entity types.

    You may only apply lightweight local mode to an EntityBean that meets the following criteria:

    • The bean implements an EJB local interface
    • No security authorization is defined on the EntityBean local home or local business interface methods
    • No "run-as" security attribute is defined on the local home or local business methods
    • The classes for the Calling bean and called EntityBean were loaded by the same Java classloader
    • The EntityBean methods do not call the WebSphere-specific Internationalization or WorkArea services.

    The first criterion prevents CMP 1.x beans from supporting lightweight local mode, since they cannot have local interfaces.

    In addition, lightweight local mode will only provide its fullest performance benefits to EntityBean methods that do not need to start a global transaction. This condition will be true if you ensure that your EntityBean also meets the following criteria:

    • A global transaction is already in effect when the EntityBean home or business method is called (typically this transaction is started by the calling SessionBean)
    • The EntityBean's local business interface methods and the bean's local home methods use only the following transaction attributes: REQUIRED, SUPPORTS, or MANDATORY.

    If an EntityBean method running in lightweight local mode must start a global transaction, it will still function normally but only a partial performance benefit will be seen.

    Implementing this interface on an entity bean causes equivalent behavior as setting the lightweightLocal field for that bean in the IBM deployment descriptor extensions (ibm-ejb-jar-ext.xmi) to "true". For scenarios where many beans extend a single root class, it can be more convenient to have that class implement this marker interface than to individually set the environment variable on each of the beans. Setting either the deployment descriptor extension or the environment variable to a value of "false" has no effect; a "false" value does not override the presence of the marker interface.

    An EntityBean that defines a remote interface or TimedObject interface (in addition to the local interface) may still be marked for lightweight local mode, but the performance benefit will only be realized when the bean is called through its local interface. If lightweight local mode is applied to any other bean type, that bean will not be allowed to run in the EJB container.

    Since:
    WAS 6.1.0
IBM WebSphere Application ServerTM
Release 9.0