Source:
public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { final Resource resource = context.createResource(PathAddress.EMPTY_ADDRESS); final ModelNode model = resource.getModel(); for (AttributeDefinition attr : AuditLogLoggerResourceDefinition.ATTRIBUTE_DEFINITIONS) { attr.validateAndSet(operation, model); } if (auditLoggerProvider != null) { context.addStep(new OperationStepHandler() { @Override public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { final boolean wasReadOnly = auditLoggerProvider.isLogReadOnly(); final AuditLogger.Status oldStatus = auditLoggerProvider.getLoggerStatus(); auditLoggerProvider.setLogBoot(AuditLogLoggerResourceDefinition.LOG_BOOT.resolveModelAttribute(context, model).asBoolean()); auditLoggerProvider.setLogReadOnly(AuditLogLoggerResourceDefinition.LOG_READ_ONLY.resolveModelAttribute(context, model).asBoolean()); boolean enabled = AuditLogLoggerResourceDefinition.ENABLED.resolveModelAttribute(context, model).asBoolean(); final AuditLogger.Status status = enabled ? AuditLogger.Status.LOGGING : AuditLogger.Status.DISABLED; context.completeStep((OperationContext.ResultAction resultAction, OperationContext context1, ModelNode operation1) -> { if(resultAction == OperationContext.ResultAction.KEEP) { auditLoggerProvider.setLoggerStatus(status); } else { auditLoggerProvider.setLoggerStatus(oldStatus); auditLoggerProvider.setLogReadOnly(wasReadOnly); } }); } }, OperationContext.Stage.RUNTIME); } context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); }

Target:
public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { final Resource resource = context.createResource(PathAddress.EMPTY_ADDRESS); final ModelNode model = resource.getModel(); for (AttributeDefinition attr : AuditLogLoggerResourceDefinition.ATTRIBUTE_DEFINITIONS) { attr.validateAndSet(operation, model); } if (auditLoggerProvider != null) { context.addStep(new OperationStepHandler() { @Override public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { final boolean wasReadOnly = auditLoggerProvider.isLogReadOnly(); final AuditLogger.Status oldStatus = auditLoggerProvider.getLoggerStatus(); auditLoggerProvider.setLogBoot(AuditLogLoggerResourceDefinition.LOG_BOOT.resolveModelAttribute(context, model).asBoolean()); auditLoggerProvider.setLogReadOnly(AuditLogLoggerResourceDefinition.LOG_READ_ONLY.resolveModelAttribute(context, model).asBoolean()); boolean enabled = AuditLogLoggerResourceDefinition.ENABLED.resolveModelAttribute(context, model).asBoolean(); final AuditLogger.Status status = enabled ? AuditLogger.Status.LOGGING : AuditLogger.Status.DISABLED; context.completeStep((OperationContext.ResultAction resultAction, OperationContext context1, ModelNode operation1) -> { if(resultAction == OperationContext.ResultAction.KEEP) { auditLoggerProvider.setLoggerStatus(status); } else { auditLoggerProvider.setLogReadOnly(wasReadOnly); } }); } }, OperationContext.Stage.RUNTIME); } context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); }