Search in sources :

Example 1 with OutboundSocketBindingPreference

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;
}
Also used : OutboundSocketBindingPreference(org.wildfly.extension.clustering.singleton.election.OutboundSocketBindingPreference) NamePreference(org.wildfly.clustering.singleton.election.NamePreference) OutboundSocketBinding(org.jboss.as.network.OutboundSocketBinding) InjectedValueDependency(org.wildfly.clustering.service.InjectedValueDependency)

Aggregations

OutboundSocketBinding (org.jboss.as.network.OutboundSocketBinding)1 InjectedValueDependency (org.wildfly.clustering.service.InjectedValueDependency)1 NamePreference (org.wildfly.clustering.singleton.election.NamePreference)1 OutboundSocketBindingPreference (org.wildfly.extension.clustering.singleton.election.OutboundSocketBindingPreference)1