|
SAP NetWeaver 7.4 (SP03) Composition Environment | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sap.tc.cmi.util.CMIThreadContextUtils
public final class CMIThreadContextUtils
Provides a primitive data storage (context) that allows different CMI consumers running in the same thread to exchange data without knowing/referencing each other. For the time being, only CMI defines the type and semantic of the data that can be stored.
Regarding this class, CMI consumers can act in two different roles:Role: Context User
A context user stores data in an existing context or retrieves data from it. Typical context users must not try to create contexts on their own. With the current API of this class, they even don't have to check whether a context exists. This is done by the provided helper methods. See the Types of Data sub topic for a description of the supported data.Role: Context Creator
A context creator defines the maximum lifetime of the data stored in the thread local storage. By calling theopenContext() method, the context
comes into life and data can be stored in and retrieved from that context.
With a call to the closeContext(String) method, the lifetime of the
context ends and all data contained therein is dereferenced. After that
time, no data can be stored in or retrieved from the context.
Currently, only a single context per thread is supported (contexts can't
be nested). In case of multiple calls to openContext, the
last one wins.
Context creators should always use try..finally to guarantee
proper cleanup of a created context:
String myRegistrationId = CMIThreadContextUtils.openContext();
try
{
...
}
finally
{
CMIThreadContextUtils.closeContext(myRegistrationId);
}
Note: For the time being, Web Dynpro is the only context creator. In later
versions of the CMI API, the methods openContext/closeContext might be moved to
a separate class which will be available through a restricted public part only
(ACL). DON'T USE openContext OR closeContext WITHOUT CONTACTING
THE AUTHOR OF THIS CLASS.
Types of Data
Currently, the only type of data managed by this context are backend execution times. They are measured to calculate the amount of time within a single request/response, that the local J2EE engine was idle and waiting for an external resource. On a frontend, these times might be displayed as backend times, in contrast to the J2EE times. All measured times are meant to be informational only, so there is no exact definition what can/must be measured or how it should be measured.
Type Classification:
This class is part of the Common Model Interface, so applications may reference it or call any method of this type, but they must not subclass it.
| Method Summary | |
|---|---|
static void |
addBackendExecutionTime(String groupId,
long durationMillis)
Adds the given backend execution time (in milliseconds) to the given group. |
static boolean |
closeContext(String callerId)
Deprecated. For Web Dynpro use only, will be moved to a separate class in a separate public part during development of NW NY. |
static Map |
getGroupedBackendExecutionTimes()
Returns an unmodifiable map with the currently known model execution times. |
static long |
getTotalBackendExecutionTime()
Returns the sum of all recorded backend execution times in all groups. |
static String |
openContext()
Deprecated. For Web Dynpro use only, will be moved to a separate class in a separate public part during development of NW NY. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static String openContext()
public static boolean closeContext(String callerId)
callerId - callerId as returned by corresponding call to openContext
public static void addBackendExecutionTime(String groupId,
long durationMillis)
groupId - String id of the groupdurationMillis - measured backend execution time in millisecondspublic static Map getGroupedBackendExecutionTimes()
Strings (those that have been used
in calls to addBackendExecutionTime since the current context
has been opened) and the values will be Longs that represent
the cumulated time values provided in these calls. All returned times are
in milliseconds.
public static long getTotalBackendExecutionTime()
| Access Rights |
|---|
| SC | DC | Public Part | ACH |
|---|---|---|---|
[sap.com] FRAMEWORK
|
[sap.com] tc/cm/ejb/api
|
api
|
BC-JAS-EJB
|
[sap.com] FRAMEWORK
|
[sap.com] tc/cmi
|
default
|
BC-WD-JAV-RUN
|
|
SAP NetWeaver 7.4 (SP03) Composition Environment | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||