private void localChangeEnd(IManagedContext<?> managedContext, boolean silent, boolean deferCommit,
                                ISurveyCallback callback) throws ContextException {

        if (pendingStack.isEmpty() || pendingStack.peek() != managedContext) {
            throw new ContextException("Illegal context change nesting.");
        }

        if (!managedContext.isPending()) {
            pendingStack.pop();
            return;
        }

        commitStack.push(managedContext);
        managedContext.surveySubscribers(silent, response -> {
            boolean accept = !response.rejected();

            if (!accept && log.isDebugEnabled()) {
                log.debug("Survey of managed context " + managedContext.getContextName() + " returned '" + response + "'.");
            }

            pendingStack.remove(managedContext);

            if (!deferCommit && (!accept || pendingStack.isEmpty())) {
                commitContexts(accept, accept);
            }

            execCallback(callback, response);
        });
    }
private void localChangeEnd ( IManagedContext < ? > managedContext , boolean silent , boolean deferCommit , ISurveyCallback callback ) throws ContextException { if ( pendingStack . isEmpty ( ) || pendingStack . peek ( ) != managedContext ) { throw new ContextException ( "Illegal context change nesting." ) ; } if ( ! managedContext . isPending ( ) ) { pendingStack . pop ( ) ; return ; } commitStack . push ( managedContext ) ; managedContext . surveySubscribers ( silent , response -> { boolean accept = ! response . rejected ( ) ; if ( ! accept && log . isDebugEnabled ( ) ) { log . debug ( "Survey of managed context " + managedContext . getContextName ( ) + " returned '" + response + "'." ) ; } pendingStack . remove ( managedContext ) ; if ( ! deferCommit && ( ! accept || pendingStack . isEmpty ( ) ) ) { commitContexts ( accept , accept ) ; } execCallback ( callback , response ) ; } ) ; }
Commits a pending context change.

@param managedContext The managed context of interest.
@param silent If true, this is a silent context change.
@param deferCommit If true, don't commit the context change, just survey subscribers.
@param callback Callback for polling.
@throws ContextException during illegal context change nesting