Oracle Fusion Middleware
Java API Reference for Oracle WebLogic Server
12c (12.1.2)

Part Number E27170-01

weblogic.diagnostics.context
Class DiagnosticContextHelper

java.lang.Object
  extended by weblogic.diagnostics.context.DiagnosticContextHelper
All Implemented Interfaces:
DiagnosticContextConstants

public final class DiagnosticContextHelper
extends Object
implements DiagnosticContextConstants

Use this class to provide applications limited access to the diagnostic context. Applications can access, but not set, the immutable context ID attribute for a diagnostic context. Each context is assigned an immutable ID when created. The context also contains a dye vector (a bit vector). Each bit in the dye vector indicates the presence of a dye in the diagnostic context. Dye bits in the dye vector correspond to different properties of the request for which the diagnostic context is created. For example, dye USER1 indicates that the request was originated by a specific user. Applications can inspect dyes in the diagnostic context. They can also modify a subset of dye flags in the dye vector for their own use, identified by DYE_0 through DYE_7.


Field Summary
 
Fields inherited from interface weblogic.diagnostics.context.DiagnosticContextConstants
ADDR1, ADDR2, ADDR3, ADDR4, CONNECTOR1, CONNECTOR2, CONNECTOR3, CONNECTOR4, COOKIE1, COOKIE2, COOKIE3, COOKIE4, DYE_0, DYE_1, DYE_2, DYE_3, DYE_4, DYE_5, DYE_6, DYE_7, PROTOCOL_HTTP, PROTOCOL_IIOP, PROTOCOL_JRMP, PROTOCOL_RMI, PROTOCOL_SSL, PROTOCOL_T3, THROTTLE, USER1, USER2, USER3, USER4
 
Constructor Summary
DiagnosticContextHelper()
           
 
Method Summary
static String getContextId()
          The immutable identifier for the current diagnostic context, which is unique within the domain.
static String[] getDyeFlagNames()
          An array of valid dye flag names.
static long getDyeVector()
          Return the dye vector of the diagnostic context.
static int getLogLevel()
          Gets the log level currently set into the diagnostic context.
static String getPayload()
          Deprecated.  
static String getRID()
          Return the relationship-id of the diagnostic context.
static boolean isDyedWith(byte dye)
          Tests whether the diagnostic context is marked with the given dye.
static long parseDyeMask(String mask)
          Parses a comma-separated string of dye flag names, and returns the corresponding dye mask.
static long parseDyeMask(String[] maskNames)
          Parses an array of dye flag names, and returns the corresponding dye mask.
static void setDye(byte dye, boolean enable)
          Sets an application-available dye flag (DYE_0 throughDYE_7) to be used to mark the diagnostic context.
static void setLogLevel(int level)
          Sets the specified log level into the diagnostic context.
static void setPayload(String payload)
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiagnosticContextHelper

public DiagnosticContextHelper()
Method Detail

getContextId

public static String getContextId()

The immutable identifier for the current diagnostic context, which is unique within the domain.

Returns:
unique id of the current diagnostic context

setDye

public static void setDye(byte dye,
                          boolean enable)
                   throws InvalidDyeException

Sets an application-available dye flag (DYE_0 throughDYE_7) to be used to mark the diagnostic context.

Parameters:
dye - The dye whose value is to be set
enable - the value of the dye, true to dye, false to undye
Throws:
InvalidDyeException - if dye index is out of range

isDyedWith

public static boolean isDyedWith(byte dye)
                          throws InvalidDyeException

Tests whether the diagnostic context is marked with the given dye. All dye flags [0...63] can be inspected by application code.

Parameters:
dye - The dye to check
Returns:
true if context is dyed with given context; false otherwise.
Throws:
InvalidDyeException - if dye index is out of range.

getPayload

public static String getPayload()
Deprecated. 

The user payload inserted in the diagnostic context. A payload is an arbitrary string which you insert into the context for later retrieval.

Returns:
user payload in the diagnostic context. Returns null if none exists.

setPayload

public static void setPayload(String payload)
Deprecated. 

Sets the value of the Payload attribute.

Parameters:
payload - user payload
See Also:
DiagnosticContextHelper.getPayload()

parseDyeMask

public static long parseDyeMask(String mask)

Parses a comma-separated string of dye flag names, and returns the corresponding dye mask. For example: USER1,ADDR1.


parseDyeMask

public static long parseDyeMask(String[] maskNames)

Parses an array of dye flag names, and returns the corresponding dye mask. For example: ["USER1", "ADDR1"].


getDyeFlagNames

public static String[] getDyeFlagNames()

An array of valid dye flag names.

Returns:
Names of available dye flags.

getRID

public static String getRID()
Return the relationship-id of the diagnostic context. If the diagnostic context did not exist before, and if context creation is enabled, a new context will be created and its relationship-id will be returned.


getLogLevel

public static int getLogLevel()
Gets the log level currently set into the diagnostic context.

Returns:
log level currently set into the context.

setLogLevel

public static void setLogLevel(int level)
Sets the specified log level into the diagnostic context.

Parameters:
level - log level that needs to be set into the diagnostic context.

getDyeVector

public static long getDyeVector()
Return the dye vector of the diagnostic context. If the diagnostic context did not exist before, and if context creation is enabled, a new context will be created and its dye vector will be returned.


Copyright 1996, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Oracle Fusion Middleware
Java API Reference for Oracle WebLogic Server
12c (12.1.2)

Part Number E27170-01