Source:
<code>private void executeDoneStage(ModelNode primaryResponse) { Throwable toThrow = null; try { ConfigurationPersister.PersistenceResource persistenceResource = null; if (isModelAffected() && resultAction != ResultAction.ROLLBACK) { try { persistenceResource = createPersistenceResource(); } catch (ConfigurationPersistenceException e) { MGMT_OP_LOGGER.failedToPersistConfigurationChange(e); primaryResponse.get(OUTCOME).set(FAILED); primaryResponse.get(FAILURE_DESCRIPTION).set(ControllerLogger.ROOT_LOGGER.failedToPersistConfigurationChange(e.getLocalizedMessage())); resultAction = ResultAction.ROLLBACK; executeResultHandlerPhase(null); return; } } final AtomicReference<ResultAction> ref = new AtomicReference<ResultAction>( transactionControl == null ? ResultAction.KEEP : ResultAction.ROLLBACK); if (transactionControl != null) { if (MGMT_OP_LOGGER.isTraceEnabled()) { MGMT_OP_LOGGER.trace("Prepared response is " + activeStep.response); } transactionControl.operationPrepared(new ModelController.OperationTransaction() { public void commit() { ref.set(ResultAction.KEEP); } public void rollback() { ref.set(ResultAction.ROLLBACK); } }, primaryResponse); } resultAction = ref.get(); if (persistenceResource != null) { if (resultAction == ResultAction.ROLLBACK) { persistenceResource.rollback(); } else { persistenceResource.commit(); } } <START> publishCapabilityRegistry(); <END> } catch (Throwable t) { toThrow = t; resultAction = ResultAction.ROLLBACK; } finally { executeResultHandlerPhase(toThrow); } }</code><technical_language>3 cases here: 1) persistenceResource == null 2) persistenceResource != null && resultAction == ResultAction.KEEP 3) persistenceResource != null && resultAction == ResultAction.ROLLBACK publishCapabilityRegistry(); happen in cases. 3rd case handled subsequent call executeResultHandlerPhase, calls operationRollingBack if resultAction != ResultAction.KEEP</technical_language>

Target:
private void executeDoneStage(ModelNode primaryResponse) { Throwable toThrow = null; try { ConfigurationPersister.PersistenceResource persistenceResource = null; if (isModelAffected() && resultAction != ResultAction.ROLLBACK) { try { persistenceResource = createPersistenceResource(); } catch (ConfigurationPersistenceException e) { MGMT_OP_LOGGER.failedToPersistConfigurationChange(e); primaryResponse.get(OUTCOME).set(FAILED); primaryResponse.get(FAILURE_DESCRIPTION).set(ControllerLogger.ROOT_LOGGER.failedToPersistConfigurationChange(e.getLocalizedMessage())); resultAction = ResultAction.ROLLBACK; executeResultHandlerPhase(null); return; } } final AtomicReference<ResultAction> ref = new AtomicReference<ResultAction>( transactionControl == null ? ResultAction.KEEP : ResultAction.ROLLBACK); if (transactionControl != null) { if (MGMT_OP_LOGGER.isTraceEnabled()) { MGMT_OP_LOGGER.trace("Prepared response is " + activeStep.response); } transactionControl.operationPrepared(new ModelController.OperationTransaction() { public void commit() { ref.set(ResultAction.KEEP); } public void rollback() { ref.set(ResultAction.ROLLBACK); } }, primaryResponse); } resultAction = ref.get(); if (persistenceResource != null) { if (resultAction == ResultAction.ROLLBACK) { persistenceResource.rollback(); } else { persistenceResource.commit(); } } if (resultAction != ResultAction.ROLLBACK) { publishCapabilityRegistry(); } } catch (Throwable t) { toThrow = t; resultAction = ResultAction.ROLLBACK; } finally { executeResultHandlerPhase(toThrow); } }