security/subsystem/src/main/java/org/jboss/as/security/service/SecurityDomainService.java
@Override
    public void start(StartContext context) throws StartException {
        SecurityLogger.ROOT_LOGGER.debugf("Starting SecurityDomainService(%s)", name);
        if (applicationPolicy != null) {
            final ApplicationPolicyRegistration applicationPolicyRegistration = (ApplicationPolicyRegistration) configurationValue
                    .getValue();
            applicationPolicyRegistration.addApplicationPolicy(applicationPolicy.getName(), applicationPolicy);
        }
        final JNDIBasedSecurityManagement securityManagement = (JNDIBasedSecurityManagement) securityManagementValue.getValue();
        AuthenticationCacheFactory cacheFactory = null;
        if ("infinispan".equals(cacheType)) {
            cacheFactory = () -> this.cacheValue.getValue();
        } else if ("default".equals(cacheType)) {
            cacheFactory = new DefaultAuthenticationCacheFactory();
        }
        SecurityDomainContext sdc;
        try {
            sdc = securityManagement.createSecurityDomainContext(name, cacheFactory, jsseSecurityDomain);
        } catch (Exception e) {
            throw SecurityLogger.ROOT_LOGGER.unableToStartException("SecurityDomainService", e);
        }
        if (jsseSecurityDomain != null) {
            try {
                jsseSecurityDomain.reloadKeyAndTrustStore();
            } catch (Exception e) {
                throw SecurityLogger.ROOT_LOGGER.unableToStartException("SecurityDomainService", e);
            }
        }
        securityManagement.getSecurityManagerMap().put(name, sdc);
        this.securityDomainContext = sdc;
    }
@Override
    public void start(StartContext context) throws StartException {
        SecurityLogger.ROOT_LOGGER.debugf("Starting SecurityDomainService(%s)", name);
        if (applicationPolicy != null) {
            final ApplicationPolicyRegistration applicationPolicyRegistration = (ApplicationPolicyRegistration) configurationValue
                    .getValue();
            applicationPolicyRegistration.addApplicationPolicy(applicationPolicy.getName(), applicationPolicy);
        }
        final JNDIBasedSecurityManagement securityManagement = (JNDIBasedSecurityManagement) securityManagementValue.getValue();
        AuthenticationCacheFactory cacheFactory = null;
        if ("infinispan".equals(cacheType)) {
            cacheFactory = () -> this.cacheValue.getValue();
        } else if ("default".equals(cacheType)) {
            cacheFactory = new DefaultAuthenticationCacheFactory();
        }
        SecurityDomainContext sdc;
        try {
            sdc = securityManagement.createSecurityDomainContext(name, cacheFactory, jsseSecurityDomain);
        } catch (Exception e) {
            throw SecurityLogger.ROOT_LOGGER.unableToStartException("SecurityDomainService", e);
        }
        if (jsseSecurityDomain != null) {
            try {
                jsseSecurityDomain.reloadKeyAndTrustStore();
            } catch (Exception e) {
                throw SecurityLogger.ROOT_LOGGER.unableToStartException("SecurityDomainService", e);
            }
        }
        securityManagement.getSecurityManagerMap().put(name, sdc);
        this.securityDomainContext = sdc;
    }
{@inheritDoc}