public static void setCurrentInstance(ApplicationAssociate associate) { if (associate == null) { instance.remove(); } else { instance.set(associate); } }
public static ApplicationAssociate getCurrentInstance() { ApplicationAssociate associate = instance.get(); if (associate == null) { // Fallback to ExternalContext lookup FacesContext fc = FacesContext.getCurrentInstance(); if (fc != null) { ExternalContext extContext = fc.getExternalContext(); if (extContext != null) { return ApplicationAssociate.getInstance(extContext); } } } return associate; }