+

Search Tips   |   Advanced Search

Assembling applications for application profiling

To enable application profiling, configure tasks, create an application profile, and declaratively configure a unit of work on necessary methods.

  • Application profiling enables multiple access intent policies to be configured on the same entity bean, each specified for a particular unit of work. Use the one of the default policies or create our own. To create our own access intent policy, see the topic, Creating a custom access intent policy, in the assembly tool information center.

    1. Configure tasks. Declaratively configure tasks as described in the following topics that are located in the assembly tool information center:

      • Configure container-managed tasks for Enterprise Java Beans.

      • Configure container-managed tasks for web components.

      • Configure container-managed tasks for application clients.

      On rare occasions, you might find it necessary to configure tasks programmatically. Application profiling supports this requirement with a simple interface that enables a task name to be set before a unit of work is programmatically initiated. Setting a task name and then initiating a transaction or ActivitySession causes the task to be associated with the new unit of work. This interface cannot be used within Enterprise JavaBeans that are configured for container-managed transactions or container-managed ActivitySessions because units of work can only be associated with a task at the exact time that the unit of work is initiated. The call to set the task name must therefore be invoked before the unit of work is begun. Units of work cannot be named after they are begun. See the topic, Using the TaskNameManager interface.

      If we select the 5.x Compatibility Mode attribute on the Application Profile Service's console page, then tasks configured on J2EE 1.3 applications are not necessarily associated with units of work and can arbitrarily be applied and overridden. This is not a recommended mode of operation and can lead to unexpected deadlocks during database access. Tasks are not communicated on requests between applications that are running under the Application Profiling 5.x Compatibility Mode and applications that are not running under the compatibility mode.

      For a Version 6.0 client to interact with applications run under the Application Profiling 5.x Compatibility Mode, set the appprofileCompatibility system property to true in the client process. We can do this by specifying the -CCDappprofileCompatibility=true option when invoking the launchClient command.

    2. Create an application profile. See the assembly tool information center to complete this task.

    3. Declaratively configure a unit of work on necessary methods. In step one of this article, you defined a task on a method. The task defined on a method only becomes active when a unit of work is begun on that method's behalf. The method must begin a new unit of work for the configured task to be applied. If the method runs under an imported unit of work, then the configured task on the method is ignored and the task (if any) associated with the imported unit of work is used. If the container begins a new unit of work when the method executes, then it is associated with the configured task name. Therefore, the last step in assembling applications for application profiling is to define a unit of work on any method that has a task name (and eventually an Application Profile) associated with it. A unit of work can either be a transaction or an ActivitySession. See the topic, Define container transactions for EJB modules, for a description on how to configure a transaction on an EJB module. The topic, Configuring transactional deployment attributes, describes how to define other transaction attributes. The topic, Using the ActivitySession service, describes how to use and create an ActivitySession unit of work. For more information about the relationships between tasks and units of work, see the topic, Tasks and units of work considerations.


    What to do next

    To complete the following tasks using assembly tools see the assembly tool documentation. The following tasks can be done using assembly tools:

    • Automatic configuration of application profiling

      The assembly tool includes a static analysis engine that can assist you in configuring application profiling. The tool examines the compiled classes and the deployment descriptor of a Java EE application to determine the entry point of transactions, calculate the set of entities enlisted in each transaction, and determine whether the entities are read or updated during the course of each identified transaction.

    • Automatically configure application profiles and tasks.

      Automatically configure application profiling for an application through static analysis.

    • Apply profile-scoped access intent policies to entity beans.

      Configure entities with access intent for an application profile.

    • Create a custom access intent policy.

      Define a custom access intent policy, which can be configured for EJB 2.x and 3.0 entity beans.

    • Create an application profile.

      An application profile contains a set of access intent policies applied to an application's entity beans. The access intent policies are only applied for requests associated with tasks configured on the application profile.

    • Configure container-managed tasks for application clients.

      For application clients that programmatically begin either a transaction or ActivitySession only, configure an application client's container-managed task to associate requests from the client with an application profile.

    • Configure container-managed tasks for Web components.

      For Web components that programmatically set the configured task and then programmatically begin either a transaction or ActivitySession only, we can configure Web components application-managed tasks to associate requests from a servlet or JSPs file with application profiles.

    • Configure container-managed tasks for Enterprise JavaBeans.

      For methods that cause a new transaction or ActivitySession to be started either by the container or programmatically by the EJB developer, we can configure an enterprise bean's container-managed tasks to associate requests from the bean with application profiles.

    • Configure container-managed tasks for application clients.

      For application clients that programmatically begin either a transaction or ActivitySession only, configure an application client's container-managed task to associate requests from the client with an application profile.

    • Configure application-managed tasks for Web components.

      For Web components that programmatically begin either a transaction or ActivitySession only, we can configure a Web component's container-managed task to associate requests from a servlet or JSP file with an application profile.

    • Configure application-managed tasks for Enterprise JavaBeans.

      For Enterprise JavaBeans that programmatically set the configured task and then programmatically begin either a transaction or ActivitySession only, we can configure EJB application-managed tasks to associate requests from the bean with application profiles.


    Related concepts

  • Application profiling
  • Tasks and units of work considerations


    Related tasks

  • Apply access intent policies to methods
  • Manage application profiles
  • Use the TaskNameManager interface
  • Define container transactions for EJB modules
  • Configure transactional deployment attributes


    Related information:

    Develop EJB 3.1 applications