This documentation is for WSO2 Carbon 4.4.1. View documentation for the latest release.
Page Comparison - CarbonContext API (v.9 vs v.10) - Carbon 4.3.0 - WSO2 Documentation
Due to a known issue do not use JDK1.8.0_151 with WSO2 products. Use JDK 1.8.0_144 until JDK 1.8.0_162-ea is released.

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

PrivilegedCarbonContext is a special subclass of CarbonContext, which allows you to perform privileged operations such as, setting the tenant ID and domain, starting or ending tenant flows and more. This class can only be used by Carbon components that have the permission to get hold of an instance of the PrivilegedCarbonContext. An instance of PrivilegedCarbonContext can only be obtained using the static methods outlined in Obtaining the PrivilegedCarbonContextbelow.

Obtaining the PrivilegedCarbonContext

...

getThreadLocalCarbonContext()

Obtain Obtains the PrivilegedCarbonContext by using data stored in the current Threadthread: PrivilegedCarbonContext.getThreadLocalCarbonContext(). As a result, in cases like the deployers, where you can be sure that the deployment scheduler thread would set the ThreadLocal data, you should directly call the getThreadLocalCarbonContext method. You should have an idea, under which thread you are executing. It is better to resolve the CarbonContext outside that util method, as opposed to resolving the CarbonContext within the method.

...