public interface TaskNameManager
Application profiling introduces two concepts in order to achieve this function: tasks and profiles.
A task is a configurable name for a unit of work. Unit of work in this case means either a transaction or an ActivitySession.
A profile is simply a mapping of a task to a set of access intent policies that are configured on entity beans. When an invocation on a bean (whether by a finder method, a CMR getter, or a dynamic query) requires data to be retrieved from the back end system, the task of the active unit of work associated with the request is used to determine the exact requirement of the transaction. The same bean loads and behaves differently in the context of the task-to-profile mapping. Each profile provides the developer an opportunity to reconfigure the application's access intent.
Programmers can declaratively configure container managed tasks for J2EE web components, application clients, and Enterprise JavaBeans (EJBs). On rare occasions, it may be necessary to programatically set the current task name. Application profiling supports this requirement with the TaskNameManager interface that enables both overriding of the current task associated with the thread of execution, and resetting of the current task with the original task.
Except for J2EE 1.3 applications that are executing on a server where the 5.x Compatibility Mode attribute is selected, 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. Calls on this interface during the execution of a container-managed unit of work are simply ignored.
|Modifier and Type||Method and Description|
Sets the thread's task name to the value that was set at or imported into the beginning of the method invocation (for ejb and web components) or process (for J2EE clients).
Set the thread's current task name to the specified parameter.
void setTaskName(java.lang.String taskName) throws IllegalTaskNameException
taskName- Not null String that must have been properly linked in the deployment descriptors.
IllegalTaskNameException- Thrown if the task name is null or not declared properly in the deployment descriptor.