ejb3/src/main/java/org/jboss/as/ejb3/security/SecurityContextInterceptor.java
protected String setContextID(final String contextID) {
        if (! WildFlySecurityManager.isChecking()) {
            final String previousID = PolicyContext.getContextID();
            PolicyContext.setContextID(contextID);
            return previousID;
        } else {
            final PrivilegedAction<String> action = new SetContextIDAction(contextID);
            return AccessController.doPrivileged(action);
        }
    }
protected String setContextID(final String contextID) {
        if (! WildFlySecurityManager.isChecking()) {
            final String previousID = PolicyContext.getContextID();
            PolicyContext.setContextID(contextID);
            return previousID;
        } else {
            final PrivilegedAction<String> action = new SetContextIDAction(contextID);
            return AccessController.doPrivileged(action);
        }
    }
<p>
Sets the JACC contextID using a privileged action and returns the previousID from the {@code PolicyContext}.
</p>

@param contextID the JACC contextID to be set.
@return the previous contextID as retrieved from the {@code PolicyContext}.