Skip to content

Commit

Permalink
[WFLY-4715] Use default value for comparison when currentValue is und…
Browse files Browse the repository at this point in the history
…efined
  • Loading branch information
asoldano committed Jun 1, 2015
1 parent b3fae18 commit 85ea9d9
Showing 1 changed file with 11 additions and 1 deletion.
Expand Up @@ -57,7 +57,7 @@ protected boolean applyUpdateToRuntime(OperationContext context, ModelNode opera

//if the server is booting or the required value is the current one,
//we do not need to do anything and reload is not required
if (resolvedValue.equals(currentValue) || context.isBooting()) {
if (isSameValue(resolvedValue, currentValue, attributeName) || context.isBooting()) {
return false;
}

Expand All @@ -67,6 +67,16 @@ protected boolean applyUpdateToRuntime(OperationContext context, ModelNode opera
return !done; //reload required if runtime has not been updated
}

private boolean isSameValue(ModelNode resolvedValue, ModelNode currentValue, String attributeName) {
if (resolvedValue.equals(currentValue)) {
return true;
}
if (!currentValue.isDefined()) {
return resolvedValue.equals(getAttributeDefinition(attributeName).getDefaultValue());
}
return false;
}

@Override
protected void revertUpdateToRuntime(OperationContext context, ModelNode operation, String attributeName,
ModelNode valueToRestore, ModelNode valueToRevert, WSServerConfigAttributeHandler.RollbackInfo handback) throws OperationFailedException {
Expand Down

0 comments on commit 85ea9d9

Please sign in to comment.