public static String getTenantDomainFromId(int tid) { SuperTenantCarbonContext.startTenantFlow(); SuperTenantCarbonContext.getCurrentContext().setTenantId(tid); String tenantDomain = SuperTenantCarbonContext.getCurrentContext().getTenantDomain(); SuperTenantCarbonContext.endTenantFlow(); return tenantDomain; }
public void onLogin(Registry configSystemRegistry, LoginEvent loginEvent) { try { if (initializedTenants.contains(loginEvent.getTenantId())) { return; } initializedTenants.add(loginEvent.getTenantId()); SuperTenantCarbonContext.startTenantFlow(); try { SuperTenantCarbonContext.getCurrentContext().setTenantId(loginEvent.getTenantId()); SuperTenantCarbonContext.getCurrentContext().setUsername(loginEvent.getUsername()); CommonUtil.addDefaultHandlersIfNotAvailable(configSystemRegistry); } finally { SuperTenantCarbonContext.endTenantFlow(); } } catch (Exception e) { String msg = "Error in adding the default handlers"; log.error(msg, e); } }