Skip to content

Commit

Permalink
[WFCORE-7035]: WIP
Browse files Browse the repository at this point in the history
Trying to get Brian's comment into account.

Signed-off-by: Emmanuel Hugonnet <[email protected]>
  • Loading branch information
ehsavoie committed Dec 9, 2024
1 parent 41b3b80 commit 635ff97
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -533,8 +533,7 @@ boolean boot(final List<ModelNode> bootList, final OperationMessageHandler handl
// stop
break;
} else {
if(parsedOp.handler instanceof ParallelBootOperationStepHandler &&
((ParallelBootOperationStepHandler)parsedOp.handler).getParsedBootOp().getChildOperations().size() != parsedOp.getChildOperations().size()) {
if(parsedOp.isBootHandlerUpdateNeeded()) {
ParallelBootOperationStepHandler updatedHandler = new ParallelBootOperationStepHandler(executorService, managementModel.get().getRootResourceRegistration(), processState, this, operationID, extraValidationStepHandler);
for(ModelNode childOp : parsedOp.getChildOperations()) {
updatedHandler.addSubsystemOperation(new ParsedBootOp(childOp));
Expand Down
16 changes: 16 additions & 0 deletions controller/src/main/java/org/jboss/as/controller/ParsedBootOp.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class ParsedBootOp {
public final OperationStepHandler handler;
public final ModelNode response;
private List<ModelNode> childOperations;
private boolean bootHandlerUpdateNeeded = false;

ParsedBootOp(final ModelNode operation) {
this(operation, null, new ModelNode());
Expand Down Expand Up @@ -84,6 +85,21 @@ public PathAddress getAddress() {
return address;
}

public boolean isBootHandlerUpdateNeeded() {
return this.handler instanceof ParallelBootOperationStepHandler
&& (
bootHandlerUpdateNeeded
|| ((ParallelBootOperationStepHandler) this.handler).getParsedBootOp().getChildOperations().size() != getChildOperations().size());
}

/**
* Setting this will force the ParallelBootOperationStepHandler handdler to be updated on boot.
*/
public void bootHandlerUpdateNeeded() {
this.bootHandlerUpdateNeeded = true;
}


@Override
public String toString() {
return "ParsedBootOp{" + "operation=" + operation + ", operationName=" + operationName + ", address=" + address + ", handler=" + handler + ", response=" + response + ", childOperations=" + childOperations + '}';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3805,4 +3805,8 @@ OperationFailedRuntimeException capabilityAlreadyRegisteredInContext(String capa

@Message(id = 516, value = "Parameter %s specifies an invalid module name: %s")
OperationFailedException invalidModuleNameParameter(String parameterName, String moduleName);

@LogMessage(level = WARN)
@Message(id = 517, value = "There are multiple Parallel Boot Operations.")
void multipleParallelBootOperation();
}
Original file line number Diff line number Diff line change
Expand Up @@ -168,23 +168,22 @@ public void processOperations(ImmutableManagementResourceRegistration rootRegist
xmlOperations.put(op.getAddress(), op);
} else {
if (op.handler instanceof ParallelBootOperationStepHandler) {
/* We need to createa new ParsedBootOp so that the handler number of childOperations is different from the number of childOperation of the handler and thus the handler will be properly updated.
* @see ModelCOntrollerImpl.boot(final List<ModelNode> bootList, final OperationMessageHandler handler, final OperationTransactionControl control,
/* We need to force the ParallelBootOperationStepHandler to be updated during the boot ( around line 536)
* @see ModelControllerImpl.boot(final List<ModelNode> bootList, final OperationMessageHandler handler, final OperationTransactionControl control,
* final boolean rollbackOnRuntimeFailure, MutableRootResourceRegistrationProvider parallelBootRootResourceRegistrationProvider,
* final boolean skipModelValidation, final boolean partialModel, final ConfigurationExtension configExtension)
*/
parallelBootOp = new ParsedBootOp(op, op.handler);
for (ModelNode childOp : childOperations) {
ParsedBootOp subOp = new ParsedBootOp(childOp, null);
xmlOperations.put(subOp.getAddress(), subOp);
parallelBootOp.addChildOperation(subOp);
}
} else {
for (ModelNode childOp : childOperations) {
ParsedBootOp subOp = new ParsedBootOp(childOp, null);
xmlOperations.put(subOp.getAddress(), subOp);
if (parallelBootOp == null) {
op.bootHandlerUpdateNeeded();
parallelBootOp = op;
} else {
MGMT_OP_LOGGER.multipleParallelBootOperation();
}
}
for (ModelNode childOp : childOperations) {
ParsedBootOp subOp = new ParsedBootOp(childOp, null);
xmlOperations.put(subOp.getAddress(), subOp);
}
}
}
for (Map<String, Object> config : configs) {
Expand Down

0 comments on commit 635ff97

Please sign in to comment.