Java Code Examples for org.jboss.as.controller.OperationContext#setRollbackOnly()
The following examples show how to use
org.jboss.as.controller.OperationContext#setRollbackOnly() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ManagementInterfaceAddStepHandler.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { Boolean attachment = context.getAttachment(MANAGEMENT_INTERFACE_KEY); if (attachment == null ||!context.getAttachment(MANAGEMENT_INTERFACE_KEY)) { ROOT_LOGGER.missingManagementServices(); context.setRollbackOnly(); } }
Example 2
Source File: ErrorExtension.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { context.getFailureDescription().set("rollback"); context.setRollbackOnly(); }
Example 3
Source File: ServerOperationsResolverHandler.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
@Override public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { if (multiPhaseLocalContext.getLocalResponse().has(FAILURE_DESCRIPTION)) { // We do not allow failures on the host controllers in a 2-phase op context.setRollbackOnly(); } else { // Temporary hack to prevent CompositeOperationHandler throwing away domain failure data context.attachIfAbsent(CompositeOperationHandler.DOMAIN_EXECUTION_KEY, Boolean.TRUE); // Figure out what server ops are needed to correspond to the domain op we have boolean nullDomainOp = hostControllerExecutionSupport.getDomainOperation() == null; // Transformed operations might need to simulate certain behavior, so allow read-only operations to be pushed as well final boolean pushToServers= operation.hasDefined(OPERATION_HEADERS) && operation.get(OPERATION_HEADERS, DOMAIN_PUSH_TO_SERVERS).asBoolean(false); HostControllerExecutionSupport.ServerOperationProvider provider = nullDomainOp ? NO_OP_PROVIDER : new HostControllerExecutionSupport.ServerOperationProvider() { @Override public Map<Set<ServerIdentity>, ModelNode> getServerOperations(ModelNode domainOp, PathAddress address) { Map<Set<ServerIdentity>, ModelNode> ops = ServerOperationsResolverHandler.this.getServerOperations(context, domainOp, address, pushToServers); for (Map.Entry<Set<ServerIdentity>, ModelNode> entry : ops.entrySet()) { ModelNode op = entry.getValue(); //Remove the caller-type=user header if (op.hasDefined(OPERATION_HEADERS, CALLER_TYPE) && op.get(OPERATION_HEADERS, CALLER_TYPE).asString().equals(USER)) { op.get(OPERATION_HEADERS).remove(CALLER_TYPE); } } HOST_CONTROLLER_LOGGER.tracef("Server ops for %s -- %s", domainOp, ops); return ops; } }; Map<ServerIdentity, ModelNode> serverOps = hostControllerExecutionSupport.getServerOps(provider); // Format that data and provide it to the coordinator ModelNode formattedServerOps = getFormattedServerOps(serverOps); if (! serverOps.isEmpty()) { final Set<String> serversStarting = new HashSet<>(); for (Map.Entry<ServerIdentity, ModelNode> serverIdentityModelNodeEntry : serverOps.entrySet()) { String serverName = serverIdentityModelNodeEntry.getKey().getServerName(); ServerStatus serverStatus = serverInventory.determineServerStatus(serverName); if (serverStatus == ServerStatus.STARTING) { serversStarting.add(serverName); } } if (! serversStarting.isEmpty()) { throw HOST_CONTROLLER_LOGGER.serverManagementUnavailableDuringBoot(serversStarting.toString()); } } if (multiPhaseLocalContext.isCoordinator()) { // We're the coordinator, so just stash the server ops in the multiphase context // for use in the rollout plan multiPhaseLocalContext.getLocalServerOps().set(formattedServerOps); if (HOST_CONTROLLER_LOGGER.isTraceEnabled()) { HOST_CONTROLLER_LOGGER.tracef("%s server ops local response node is %s", getClass().getSimpleName(), formattedServerOps); } } else { // We're not the coordinator, so we need to propagate the server ops // to the coordinator via the response we send in the prepare part of Stage.DONE // So, change the context result to the special format used for this data ModelNode localResult = nullDomainOp ? new ModelNode(IGNORED) : multiPhaseLocalContext.getLocalResponse().get(RESULT); ModelNode domainResult = hostControllerExecutionSupport.getFormattedDomainResult(localResult); ModelNode contextResult = context.getResult(); contextResult.setEmptyObject(); contextResult.get(DOMAIN_RESULTS).set(domainResult); contextResult.get(SERVER_OPERATIONS).set(formattedServerOps); if (HOST_CONTROLLER_LOGGER.isTraceEnabled()) { HOST_CONTROLLER_LOGGER.tracef("%s server ops remote response node is %s", getClass().getSimpleName(), contextResult); } } } }
Example 4
Source File: RevertReloadRequiredTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
@Override protected void performRuntime(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException { context.setRollbackOnly(); }