use of org.wildfly.extension.clustering.singleton.election.OutboundSocketBindingPreference in project wildfly by wildfly.
the class ElectionPolicyBuilder method configure.
@Override
public Builder<SingletonElectionPolicy> configure(OperationContext context, ModelNode model) throws OperationFailedException {
this.preferences.clear();
this.dependencies.clear();
ModelNodes.optionalList(SOCKET_BINDING_PREFERENCES.resolveModelAttribute(context, model)).ifPresent(bindings -> {
bindings.stream().map(ModelNode::asString).forEach(bindingName -> {
InjectedValueDependency<OutboundSocketBinding> binding = new InjectedValueDependency<>(CommonUnaryRequirement.OUTBOUND_SOCKET_BINDING.getServiceName(context, bindingName), OutboundSocketBinding.class);
this.preferences.add(new OutboundSocketBindingPreference(binding));
this.dependencies.add(binding);
});
});
ModelNodes.optionalList(NAME_PREFERENCES.resolveModelAttribute(context, model)).ifPresent(names -> {
names.stream().map(ModelNode::asString).forEach(name -> this.preferences.add(new NamePreference(name)));
});
return this;
}
Aggregations