/** @see javax.faces.context.FacesContext#release() */
  public void release() {

    released = true;
    externalContext = null;
    responseStream = null;
    responseWriter = null;
    componentMessageLists = null;
    renderResponse = false;
    responseComplete = false;
    validationFailed = false;
    viewRoot = null;
    maxSeverity = null;
    application = null;
    currentPhaseId = null;
    if (attributes != null) {
      attributes.clear();
      attributes = null;
    }
    partialViewContext = null;
    exceptionHandler = null;
    elContext = null;
    rkFactory = null;
    lastRk = null;
    lastRkId = null;

    // PENDING(edburns): write testcase that verifies that release
    // actually works.  This will be important to keep working as
    // ivars are added and removed on this class over time.

    // Make sure to clear our ThreadLocal instance.
    setCurrentInstance(null);

    // remove our private ThreadLocal instance.
    DEFAULT_FACES_CONTEXT.remove();
  }
 public FacesContextImpl(ExternalContext ec, Lifecycle lifecycle) {
   Util.notNull("ec", ec);
   Util.notNull("lifecycle", lifecycle);
   this.externalContext = ec;
   setCurrentInstance(this);
   DEFAULT_FACES_CONTEXT.set(this);
   rkFactory = (RenderKitFactory) FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
 }
  public static FacesContext getDefaultFacesContext() {

    return DEFAULT_FACES_CONTEXT.get();
  }