using wso2bps 3.6.0

i have code like this in our process step:

import org.wso2.carbon.context.CarbonContext;
CarbonContext cctx = CarbonContext.getThreadLocalCarbonContext();
String domain = cctx.getTenantDomain();

if step marked as Exclusive this code returns correct value.

if step marked as Asynchronous then i got domain=null.

Finally this behavior fails access to other carbon properties and registry.

It seems the problem in this ThreadLocal data holder that does not return initialized holder for my Async thread in org.wso2.carbon.context.internal.CarbonContextDataHolder :

private static ThreadLocal<CarbonContextDataHolder> currentContextHolder = new ThreadLocal(){
    protected CarbonContextDataHolder initialValue(){
      return new CarbonContextDataHolder(null);
    }
};

The questions

How to get carbon domain and registry in my process step when it Asynchronous?

Maybe there is a way to initialize my thread to allow use of carbon registry?


PS: As workaround I use Exclusive step prior to long-running Anync step in my process to evaluate required carbon-dependent properties.

0

There are 0 answers