public static <E extends Throwable> void runWithoutFacesContextVar(FacesContext context, String var, Callbacks.FailableRunnable<E> runnable) throws E {
        // if no var passed just execute the callback
        if (LangUtils.isBlank(var)) {
            runnable.run();
            return;
        }

        Map<Object, Object> stateMap = context.getAttributes();

        Object oldValue = stateMap.remove(var);
        try {
            runnable.run();
        }
        finally {
            if (oldValue != null) {
                stateMap.put(var, oldValue);
            }
        }
    }
Execute a callback in a stateless scope by temporarily removing and restoring a variable from the FacesContext attributes.

@param context The FacesContext used for accessing attributes
@param var The variable to be temporarily removed and restored in the context attributes
@param runnable The callback to be executed
@param <E> The type of Throwable that may be thrown
@throws E If the callback throws an exception of type E
primefaces/src/main/java/org/primefaces/util/ComponentUtils.java