Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
base repository: wildfly/wildfly
Choose a Base Repository
wildfly/wildfly
2002simon01/jboss-as
ALRubinger/wildfly
ErikWRasmussen/jboss-as
KurtStam/jboss-as
Lerm/jboss-as
LinuxEvangelist/jboss-as
Mogztter/wildfly
OndraZizka/jboss-as
PayU-EMEA/jboss-as
aaronwalker/jboss-as
agibsonccc/jboss-as
akalachm/jboss-as
alesj/jboss-as
alns/jboss-as
aloubyansky/wildfly
aminorex/jboss-as
andersnorgaard/jboss-as
andredemathe/jboss-as
andytaylor/wildfly
aprilhu0/jboss-as
ashields/jboss-as
aslakknutsen/jboss-as
asoldano/wildfly
awirayaksa/jboss-as
bershath/jboss-as
bgeorges/jboss-as
blue61/jboss-as
bosschaert/jboss-as
bstansberry/wildfly
btison/jboss-as
cbue/jboss-as
charleswmiller/jboss-as
chikin/jboss-as
chriskriel/jboss-as
coberle/jboss-as
colmsean/jboss-as
ctomc/wildfly
dandreadis/wildfly
darranl/wildfly
dcaillia/jboss-as
denuno/jboss-as
deruelle/jboss-as
dhollandAtWex/dh-old-forks-jboss-as
dmlloyd/wildfly
dobozysaurus/jboss-as
dpospisil/wildfly
edbean/jboss-as
emannuel/jboss-as
emerile1/jboss-as
emuckenhuber/wildfly
esantana/jboss-as
fbricon/jboss-as
fedora-jboss-as/wildfly
fei-yin/jboss-as
fharms/wildfly
fregaham/jboss-as
fxlambda-twickly5/wildfly
garcimouche/jboss-as
goldmann/jboss-as
gonne/jboss-as
gvagenas/jboss-as
hamanju/jboss-as
hamming229/jboss-as
heiko-braun/wildfly
hgkmiracle/jboss-as
hunter-thom/jboss-as
ikaro/jboss-as
istudens/wildfly
jaikiran/wildfly
jamezp/wildfly
janpiel/jboss-as
java-coder/jboss-as
jayhowell/jboss-as
jbossejb3/jboss-as
jdmr/jboss-as
jdpgrailsdev/jboss-as
jeenapeter/jboss-as
jeffzhang/jboss-as
jeremiahshirk/jboss-as
jiwils/jboss-as
jlindesmith/jboss-as
jmartisk/wildfly
jocstar/jboss-as
joseph2000/jboss-as
jrwhitley/jboss-as
jswordfish/jboss-as
jtoerber/jboss-as
julianzhu/jboss-as
jwulf/jboss-as
kabir/wildfly
kbys/jboss-as
koledzhikov/jboss-as
kpiwko/wildfly
kylape/wildfly
ldevrie/jboss-as
lingling788/jboss-as
liweinan/jboss-as
luksa/wildfly
lydonchandra/jboss-as
maasvdberg/wildfly
madhumita/jboss-as
madhumita12/jboss-as
maerqiang/jboss-as
maeste/jboss-as
mageshbk/jboss-as
markmc/jboss-as
markyour/jboss-as
maschmid/jboss-as
matejonnet/jboss-as
mathieuancelin/jboss-as
mathieufortin01/jboss-as
mattdrees/jboss-as
maxandersen/jboss-as
maximilienw/jboss-as
mbogoevici/jboss-as
mbrasier/jboss-as
mdemerath/jboss-as
mgencur/jboss-as
michaelschuetz/jboss-as
miclark/jboss-as
migue/wildfly
mikebrock/jboss-as
mkiman/jboss-as
mlinhard/jboss-as
mmoyses/jboss-as
mojavelinux/jboss-as
mschwartzman/jboss-as
mstruk/jboss-as
nikkack/jboss-as
nookala/jboss-as
npfr/jboss-as
nscavell/jboss-as
ochaloup/wildfly
patmcdonough/jboss-as
pbielicki/jboss-as
pentarou/jboss-as
pepite/jboss-as
petbac/jboss-as
pferraro/wildfly
pmf8/jboss-as
pmuir/jboss-as
porobd/jboss-as
prabugp/jboss-as
pragnesh/jboss-as
prasad-deshpande/jboss-as
prcg66/jboss-as
pskopek/wildfly
pslegr/jboss-as
rachmatowicz/wildfly
rachmatowicz2/jboss-as
randythomas/jboss-as
rhusar/wildfly
richmidwinter/jboss-as
richsharples/jboss-as
ringerc/jboss-as
robertpanzer/jboss-as
robstryker/jboss-as
rsvoboda/wildfly
rzimmermann/jboss-as
sacdroid/jboss-as
samuelo/jboss-as
sasgww/jboss-as
scottmarlow/wildfly
sebersole/jboss-as
seeburger-ag/jboss-as
seko2000/jboss-as
sgilda/wildfly
shadangi/jboss-as
shuawest/jboss-as
sjancke/jboss-as
skoussou/jboss-as
smcgowan/wildfly
spreadline/jboss-as
ssilvert/wildfly
starksm64/jboss-as
starksmjboss/jboss-as
stliu/jboss-as
stuartwdouglas/wildfly
sujaybawaskar/jboss-as
tdiesler/wildfly
tfennelly/jboss-as
thammoud/jboss-as
thanhvc/jboss-as
thauser/jboss-as
thomasnymand/jboss-as
thunderlei/jboss-as
tomathome/jboss-as
tomwells/jboss-as
tristantarrant/wildfly
tyasuma/jboss-as
undertow-io/jboss-as
vladimirralev/jboss-as
vmariusvv/jboss-as
vratsel/jboss-as
weld/wildfly
wfink/wildfly
wolfc/jboss-as
zhigunovs/jboss-as
zhleonix/jboss-as
Nothing to show
base: 71de3e7
head repository: wildfly/wildfly
Choose a Head Repository
wildfly/wildfly
2002simon01/jboss-as
ALRubinger/wildfly
ErikWRasmussen/jboss-as
KurtStam/jboss-as
Lerm/jboss-as
LinuxEvangelist/jboss-as
Mogztter/wildfly
OndraZizka/jboss-as
PayU-EMEA/jboss-as
aaronwalker/jboss-as
agibsonccc/jboss-as
akalachm/jboss-as
alesj/jboss-as
alns/jboss-as
aloubyansky/wildfly
aminorex/jboss-as
andersnorgaard/jboss-as
andredemathe/jboss-as
andytaylor/wildfly
aprilhu0/jboss-as
ashields/jboss-as
aslakknutsen/jboss-as
asoldano/wildfly
awirayaksa/jboss-as
bershath/jboss-as
bgeorges/jboss-as
blue61/jboss-as
bosschaert/jboss-as
bstansberry/wildfly
btison/jboss-as
cbue/jboss-as
charleswmiller/jboss-as
chikin/jboss-as
chriskriel/jboss-as
coberle/jboss-as
colmsean/jboss-as
ctomc/wildfly
dandreadis/wildfly
darranl/wildfly
dcaillia/jboss-as
denuno/jboss-as
deruelle/jboss-as
dhollandAtWex/dh-old-forks-jboss-as
dmlloyd/wildfly
dobozysaurus/jboss-as
dpospisil/wildfly
edbean/jboss-as
emannuel/jboss-as
emerile1/jboss-as
emuckenhuber/wildfly
esantana/jboss-as
fbricon/jboss-as
fedora-jboss-as/wildfly
fei-yin/jboss-as
fharms/wildfly
fregaham/jboss-as
fxlambda-twickly5/wildfly
garcimouche/jboss-as
goldmann/jboss-as
gonne/jboss-as
gvagenas/jboss-as
hamanju/jboss-as
hamming229/jboss-as
heiko-braun/wildfly
hgkmiracle/jboss-as
hunter-thom/jboss-as
ikaro/jboss-as
istudens/wildfly
jaikiran/wildfly
jamezp/wildfly
janpiel/jboss-as
java-coder/jboss-as
jayhowell/jboss-as
jbossejb3/jboss-as
jdmr/jboss-as
jdpgrailsdev/jboss-as
jeenapeter/jboss-as
jeffzhang/jboss-as
jeremiahshirk/jboss-as
jiwils/jboss-as
jlindesmith/jboss-as
jmartisk/wildfly
jocstar/jboss-as
joseph2000/jboss-as
jrwhitley/jboss-as
jswordfish/jboss-as
jtoerber/jboss-as
julianzhu/jboss-as
jwulf/jboss-as
kabir/wildfly
kbys/jboss-as
koledzhikov/jboss-as
kpiwko/wildfly
kylape/wildfly
ldevrie/jboss-as
lingling788/jboss-as
liweinan/jboss-as
luksa/wildfly
lydonchandra/jboss-as
maasvdberg/wildfly
madhumita/jboss-as
madhumita12/jboss-as
maerqiang/jboss-as
maeste/jboss-as
mageshbk/jboss-as
markmc/jboss-as
markyour/jboss-as
maschmid/jboss-as
matejonnet/jboss-as
mathieuancelin/jboss-as
mathieufortin01/jboss-as
mattdrees/jboss-as
maxandersen/jboss-as
maximilienw/jboss-as
mbogoevici/jboss-as
mbrasier/jboss-as
mdemerath/jboss-as
mgencur/jboss-as
michaelschuetz/jboss-as
miclark/jboss-as
migue/wildfly
mikebrock/jboss-as
mkiman/jboss-as
mlinhard/jboss-as
mmoyses/jboss-as
mojavelinux/jboss-as
mschwartzman/jboss-as
mstruk/jboss-as
nikkack/jboss-as
nookala/jboss-as
npfr/jboss-as
nscavell/jboss-as
ochaloup/wildfly
patmcdonough/jboss-as
pbielicki/jboss-as
pentarou/jboss-as
pepite/jboss-as
petbac/jboss-as
pferraro/wildfly
pmf8/jboss-as
pmuir/jboss-as
porobd/jboss-as
prabugp/jboss-as
pragnesh/jboss-as
prasad-deshpande/jboss-as
prcg66/jboss-as
pskopek/wildfly
pslegr/jboss-as
rachmatowicz/wildfly
rachmatowicz2/jboss-as
randythomas/jboss-as
rhusar/wildfly
richmidwinter/jboss-as
richsharples/jboss-as
ringerc/jboss-as
robertpanzer/jboss-as
robstryker/jboss-as
rsvoboda/wildfly
rzimmermann/jboss-as
sacdroid/jboss-as
samuelo/jboss-as
sasgww/jboss-as
scottmarlow/wildfly
sebersole/jboss-as
seeburger-ag/jboss-as
seko2000/jboss-as
sgilda/wildfly
shadangi/jboss-as
shuawest/jboss-as
sjancke/jboss-as
skoussou/jboss-as
smcgowan/wildfly
spreadline/jboss-as
ssilvert/wildfly
starksm64/jboss-as
starksmjboss/jboss-as
stliu/jboss-as
stuartwdouglas/wildfly
sujaybawaskar/jboss-as
tdiesler/wildfly
tfennelly/jboss-as
thammoud/jboss-as
thanhvc/jboss-as
thauser/jboss-as
thomasnymand/jboss-as
thunderlei/jboss-as
tomathome/jboss-as
tomwells/jboss-as
tristantarrant/wildfly
tyasuma/jboss-as
undertow-io/jboss-as
vladimirralev/jboss-as
vmariusvv/jboss-as
vratsel/jboss-as
weld/wildfly
wfink/wildfly
wolfc/jboss-as
zhigunovs/jboss-as
zhleonix/jboss-as
Nothing to show
compare: 8f6c2ec
  • 4 commits
  • 18 files changed
  • 0 commit comments
  • 2 contributors
Commits on Mar 29, 2019
Commits on Apr 24, 2019
WFLY-11807 Auto-configure external address/port for FD_SOCK protocol based on socket binding's client mappings
Showing with 303 additions and 44 deletions.
  1. +11 −0 ...a/org/jboss/as/clustering/jgroups/subsystem/AbstractProtocolConfigurationServiceConfigurator.java
  2. +3 −2 ...ering/jgroups/extension/src/main/java/org/jboss/as/clustering/jgroups/subsystem/JGroupsModel.java
  3. +1 −10 .../extension/src/main/java/org/jboss/as/clustering/jgroups/subsystem/JGroupsSubsystemXMLReader.java
  4. +3 −1 .../extension/src/main/java/org/jboss/as/clustering/jgroups/subsystem/JGroupsSubsystemXMLWriter.java
  5. +3 −1 ...boss/as/clustering/jgroups/subsystem/MulticastSocketProtocolConfigurationServiceConfigurator.java
  6. +92 −0 ...va/org/jboss/as/clustering/jgroups/subsystem/OptionalSocketBindingProtocolResourceDefinition.java
  7. +14 −0 ...roups/extension/src/main/java/org/jboss/as/clustering/jgroups/subsystem/ProtocolRegistration.java
  8. +1 −5 ...boss/as/clustering/jgroups/subsystem/SocketDiscoveryProtocolConfigurationServiceConfigurator.java
  9. +97 −0 ...ava/org/jboss/as/clustering/jgroups/subsystem/SocketProtocolConfigurationServiceConfigurator.java
  10. +5 −5 ...ain/java/org/jboss/as/clustering/jgroups/subsystem/TransportConfigurationServiceConfigurator.java
  11. +42 −11 clustering/jgroups/extension/src/main/java/org/jboss/as/clustering/jgroups/subsystem/XMLElement.java
  12. +4 −2 clustering/jgroups/extension/src/main/resources/subsystem-templates/jgroups.xml
  13. +1 −1 .../extension/src/test/resources/org/jboss/as/clustering/jgroups/subsystem/subsystem-jgroups-5_0.xml
  14. +1 −1 .../extension/src/test/resources/org/jboss/as/clustering/jgroups/subsystem/subsystem-jgroups-6_0.xml
  15. +1 −1 ...rc/test/resources/org/jboss/as/clustering/jgroups/subsystem/subsystem-jgroups-transform-6_0_0.xml
  16. +10 −0 galleon-pack/src/main/resources/feature_groups/domain-jgroups-sockets.xml
  17. +10 −0 galleon-pack/src/main/resources/feature_groups/jgroups-sockets.xml
  18. +4 −4 galleon-pack/src/main/resources/feature_groups/jgroups.xml
@@ -26,6 +26,7 @@
import static org.jboss.as.clustering.jgroups.subsystem.AbstractProtocolResourceDefinition.Attribute.PROPERTIES;
import static org.jboss.as.clustering.jgroups.subsystem.AbstractProtocolResourceDefinition.Attribute.STATISTICS_ENABLED;

import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction;
import java.util.Collections;
import java.util.HashMap;
@@ -130,4 +131,14 @@ public final P createProtocol(ProtocolStackConfiguration stackConfiguration) {
throw new IllegalArgumentException(e);
}
}

void setValue(P protocol, String propertyName, Object propertyValue) {
PrivilegedAction<P> action = new PrivilegedAction<P>() {
@Override
public P run() {
return protocol.setValue(propertyName, propertyValue);
}
};
WildFlySecurityManager.doUnchecked(action);
}
}
@@ -36,9 +36,10 @@
VERSION_4_0_0(4, 0, 0), // WildFly 10, EAP 7.0
VERSION_4_1_0(4, 1, 0), // WildFly 10.1
VERSION_5_0_0(5, 0, 0), // WildFly 11, EAP 7.1
VERSION_6_0_0(6, 0, 0), // WildFly 12-15, EAP 7.2
VERSION_6_0_0(6, 0, 0), // WildFly 12-16, EAP 7.2
VERSION_7_0_0(7, 0, 0), // WildFly 17
;
static final JGroupsModel CURRENT = VERSION_6_0_0;
static final JGroupsModel CURRENT = VERSION_7_0_0;

private final ModelVersion version;

@@ -32,7 +32,6 @@
import javax.xml.stream.XMLStreamException;

import org.jboss.as.clustering.controller.Attribute;
import org.jboss.as.clustering.controller.Operations;
import org.jboss.as.controller.AttributeDefinition;
import org.jboss.as.controller.AttributeParser;
import org.jboss.as.controller.PathAddress;
@@ -635,15 +634,7 @@ private void parseProtocolAttribute(XMLExtendedStreamReader reader, int index, M
break;
}
case SOCKET_BINDING: {
String protocol = Operations.getPathAddress(operation).getLastElement().getValue();
Attribute socketBindingAttribute = GenericProtocolResourceDefinition.DeprecatedAttribute.SOCKET_BINDING;
for (ProtocolRegistration.MulticastProtocol multicastProtocol : EnumSet.allOf(ProtocolRegistration.MulticastProtocol.class)) {
if (protocol.equals(multicastProtocol.name())) {
socketBindingAttribute = SocketBindingProtocolResourceDefinition.Attribute.SOCKET_BINDING;
break;
}
}
readAttribute(reader, index, operation, socketBindingAttribute);
readAttribute(reader, index, operation, GenericProtocolResourceDefinition.DeprecatedAttribute.SOCKET_BINDING);
break;
}
case DATA_SOURCE: {
@@ -117,7 +117,7 @@ private static void writeTransport(XMLExtendedStreamWriter writer, Property prop
}

private static void writeProtocol(XMLExtendedStreamWriter writer, Property property) throws XMLStreamException {
writer.writeStartElement(XMLElement.forProtocolName(property.getName()).getLocalName());
writer.writeStartElement(XMLElement.forProtocolName(property).getLocalName());
writeProtocolAttributes(writer, property);
writeElement(writer, property.getValue(), AbstractProtocolResourceDefinition.Attribute.PROPERTIES);
writer.writeEndElement();
@@ -135,6 +135,8 @@ private static void writeProtocolAttributes(XMLExtendedStreamWriter writer, Prop
String protocol = property.getName();
if (containsName(ProtocolRegistration.MulticastProtocol.class, protocol)) {
writeAttributes(writer, property.getValue(), SocketBindingProtocolResourceDefinition.Attribute.class);
} else if (containsName(ProtocolRegistration.SocketProtocol.class, protocol)) {
writeAttributes(writer, property.getValue(), OptionalSocketBindingProtocolResourceDefinition.Attribute.class);
} else if (containsName(ProtocolRegistration.JdbcProtocol.class, protocol)) {
writeAttributes(writer, property.getValue(), JDBCProtocolResourceDefinition.Attribute.class);
} else if (containsName(ProtocolRegistration.EncryptProtocol.class, protocol)) {
@@ -22,6 +22,8 @@

package org.jboss.as.clustering.jgroups.subsystem;

import static org.jboss.as.clustering.jgroups.subsystem.SocketBindingProtocolResourceDefinition.Attribute.SOCKET_BINDING;

import java.util.Collections;
import java.util.Map;

@@ -56,7 +58,7 @@ public MulticastSocketProtocolConfigurationServiceConfigurator(PathAddress addre

@Override
public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException {
String bindingName = SocketBindingProtocolResourceDefinition.Attribute.SOCKET_BINDING.resolveModelAttribute(context, model).asString();
String bindingName = SOCKET_BINDING.resolveModelAttribute(context, model).asString();
this.binding = new ServiceSupplierDependency<>(CommonUnaryRequirement.SOCKET_BINDING.getServiceName(context, bindingName));
return super.configure(context, model);
}
@@ -0,0 +1,92 @@
/*
* JBoss, Home of Professional Open Source.
* Copyright 2017, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/

package org.jboss.as.clustering.jgroups.subsystem;

import java.util.function.UnaryOperator;

import org.jboss.as.clustering.controller.CapabilityReference;
import org.jboss.as.clustering.controller.CommonUnaryRequirement;
import org.jboss.as.clustering.controller.ResourceDescriptor;
import org.jboss.as.clustering.controller.ResourceServiceConfiguratorFactory;
import org.jboss.as.controller.AttributeDefinition;
import org.jboss.as.controller.ModelVersion;
import org.jboss.as.controller.SimpleAttributeDefinitionBuilder;
import org.jboss.as.controller.access.management.SensitiveTargetAccessConstraintDefinition;
import org.jboss.as.controller.descriptions.ModelDescriptionConstants;
import org.jboss.as.controller.registry.AttributeAccess;
import org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder;
import org.jboss.dmr.ModelType;

/**
* Resource definition override for protocols that have an optional socket-binding.
* @author Paul Ferraro
*/
public class OptionalSocketBindingProtocolResourceDefinition extends ProtocolResourceDefinition {

enum Attribute implements org.jboss.as.clustering.controller.Attribute, UnaryOperator<SimpleAttributeDefinitionBuilder> {
SOCKET_BINDING(ModelDescriptionConstants.SOCKET_BINDING, ModelType.STRING) {
@Override
public SimpleAttributeDefinitionBuilder apply(SimpleAttributeDefinitionBuilder builder) {
return builder.setAccessConstraints(SensitiveTargetAccessConstraintDefinition.SOCKET_BINDING_REF)
.setCapabilityReference(new CapabilityReference(Capability.PROTOCOL, CommonUnaryRequirement.SOCKET_BINDING))
;
}
},
;
private final AttributeDefinition definition;

Attribute(String name, ModelType type) {
this.definition = this.apply(new SimpleAttributeDefinitionBuilder(name, type)
.setRequired(false)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
).build();
}

@Override
public AttributeDefinition getDefinition() {
return this.definition;
}
}

static void addTransformations(ModelVersion version, ResourceTransformationDescriptionBuilder builder) {

ProtocolResourceDefinition.addTransformations(version, builder);
}

private static class ResourceDescriptorConfigurator implements UnaryOperator<ResourceDescriptor> {
private final UnaryOperator<ResourceDescriptor> configurator;

ResourceDescriptorConfigurator(UnaryOperator<ResourceDescriptor> configurator) {
this.configurator = configurator;
}

@Override
public ResourceDescriptor apply(ResourceDescriptor descriptor) {
return this.configurator.apply(descriptor).addAttributes(Attribute.class);
}
}

OptionalSocketBindingProtocolResourceDefinition(String name, UnaryOperator<ResourceDescriptor> configurator, ResourceServiceConfiguratorFactory serviceConfiguratorFactory, ResourceServiceConfiguratorFactory parentServiceConfiguratorFactory) {
super(pathElement(name), new ResourceDescriptorConfigurator(configurator), serviceConfiguratorFactory, parentServiceConfiguratorFactory);
}
}
@@ -84,6 +84,10 @@
MPING;
}

enum SocketProtocol {
FD_SOCK;
}

enum LegacyProtocol {
MERGE2(MERGE3.class, JGroupsModel.VERSION_6_0_0),
NAKACK("pbcast.NAKACK", NAKACK2.class, JGroupsModel.VERSION_6_0_0),
@@ -107,6 +111,13 @@
static void buildTransformation(ModelVersion version, ResourceTransformationDescriptionBuilder parent) {
ProtocolResourceDefinition.addTransformations(version, parent.addChildResource(ProtocolResourceDefinition.WILDCARD_PATH));

for (SocketProtocol protocol : EnumSet.allOf(SocketProtocol.class)) {
PathElement path = ProtocolResourceDefinition.pathElement(protocol.name());
if (!JGroupsModel.VERSION_7_0_0.requiresTransformation(version)) {
OptionalSocketBindingProtocolResourceDefinition.addTransformations(version, parent.addChildResource(path));
}
}

for (MulticastProtocol protocol : EnumSet.allOf(MulticastProtocol.class)) {
PathElement path = ProtocolResourceDefinition.pathElement(protocol.name());
if (!JGroupsModel.VERSION_5_0_0.requiresTransformation(version)) {
@@ -182,6 +193,9 @@ public void register(ManagementResourceRegistration registration) {
new GenericProtocolResourceDefinition(this.configurator, this.parentServiceConfiguratorFactory).register(registration);

// Override definitions for protocol types
for (SocketProtocol protocol : EnumSet.allOf(SocketProtocol.class)) {
new OptionalSocketBindingProtocolResourceDefinition(protocol.name(), this.configurator, SocketProtocolConfigurationServiceConfigurator::new, this.parentServiceConfiguratorFactory).register(registration);
}
for (MulticastProtocol protocol : EnumSet.allOf(MulticastProtocol.class)) {
new SocketBindingProtocolResourceDefinition(protocol.name(), this.configurator, MulticastSocketProtocolConfigurationServiceConfigurator::new, this.parentServiceConfiguratorFactory).register(registration);
}
@@ -26,7 +26,6 @@

import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
@@ -43,12 +42,10 @@
import org.jboss.dmr.ModelNode;
import org.jboss.msc.service.ServiceBuilder;
import org.jgroups.protocols.Discovery;
import org.jgroups.stack.Protocol;
import org.wildfly.clustering.service.Dependency;
import org.wildfly.clustering.service.ServiceConfigurator;
import org.wildfly.clustering.service.ServiceSupplierDependency;
import org.wildfly.clustering.service.SupplierDependency;
import org.wildfly.security.manager.WildFlySecurityManager;

/**
* @author Paul Ferraro
@@ -93,8 +90,7 @@ public void accept(P protocol) {
}
}
// In the absence of some common interface, we need to use reflection
PrivilegedAction<Protocol> action = () -> protocol.setValue("initial_hosts", initialHosts);
WildFlySecurityManager.doUnchecked(action);
this.setValue(protocol, "initial_hosts", initialHosts);
}
}
}
@@ -0,0 +1,97 @@
/*
* JBoss, Home of Professional Open Source.
* Copyright 2019, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/

package org.jboss.as.clustering.jgroups.subsystem;

import static org.jboss.as.clustering.jgroups.subsystem.OptionalSocketBindingProtocolResourceDefinition.Attribute.SOCKET_BINDING;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Collections;
import java.util.List;
import java.util.Map;

import org.jboss.as.clustering.controller.CommonUnaryRequirement;
import org.jboss.as.controller.OperationContext;
import org.jboss.as.controller.OperationFailedException;
import org.jboss.as.controller.PathAddress;
import org.jboss.as.network.ClientMapping;
import org.jboss.as.network.SocketBinding;
import org.jboss.dmr.ModelNode;
import org.jboss.msc.service.ServiceBuilder;
import org.jgroups.protocols.FD_SOCK;
import org.wildfly.clustering.service.ServiceConfigurator;
import org.wildfly.clustering.service.ServiceSupplierDependency;
import org.wildfly.clustering.service.SimpleSupplierDependency;
import org.wildfly.clustering.service.SupplierDependency;

/**
* Configures a service that provides a FD_SOCK protocol.
* @author Paul Ferraro
*/
public class SocketProtocolConfigurationServiceConfigurator extends ProtocolConfigurationServiceConfigurator<FD_SOCK> {

private volatile SupplierDependency<SocketBinding> binding;

public SocketProtocolConfigurationServiceConfigurator(PathAddress address) {
super(address);
}

@Override
public <T> ServiceBuilder<T> register(ServiceBuilder<T> builder) {
return super.register(this.binding.register(builder));
}

@Override
public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException {
String bindingName = SOCKET_BINDING.resolveModelAttribute(context, model).asString(null);
this.binding = (bindingName != null) ? new ServiceSupplierDependency<>(CommonUnaryRequirement.SOCKET_BINDING.getServiceName(context, bindingName)) : new SimpleSupplierDependency<>(null);
return super.configure(context, model);
}

@Override
public Map<String, SocketBinding> getSocketBindings() {
return Collections.singletonMap("jgroups.fd_sock.srv_sock", this.binding.get());
}

@Override
public void accept(FD_SOCK protocol) {
// If binding is undefined, protocol will use bind address of transport and a random ephemeral port
SocketBinding binding = this.binding.get();
if (binding != null) {
protocol.setValue("bind_addr", binding.getAddress());
protocol.setValue("start_port", binding.getPort());

List<ClientMapping> clientMappings = binding.getClientMappings();
if (!clientMappings.isEmpty()) {
// JGroups cannot select a client mapping based on the source address, so just use the first one
ClientMapping mapping = clientMappings.get(0);
try {
this.setValue(protocol, "external_addr", InetAddress.getByName(mapping.getDestinationAddress()));
this.setValue(protocol, "external_port", mapping.getDestinationPort());
} catch (UnknownHostException e) {
throw new IllegalArgumentException(e);
}
}
}
}
}
@@ -145,8 +145,8 @@ public void accept(T protocol) {
// JGroups cannot select a client mapping based on the source address, so just use the first one
ClientMapping mapping = clientMappings.get(0);
try {
protocol.setValue("external_addr", InetAddress.getByName(mapping.getDestinationAddress()));
protocol.setValue("external_port", mapping.getDestinationPort());
this.setValue(protocol, "external_addr", InetAddress.getByName(mapping.getDestinationAddress()));
this.setValue(protocol, "external_port", mapping.getDestinationPort());
} catch (UnknownHostException e) {
throw new IllegalArgumentException(e);
}
@@ -164,11 +164,11 @@ public void accept(T protocol) {
;
protocol.setInternalThreadPool(factory.apply(protocol.getInternalThreadPoolThreadFactory()));

protocol.setValue("enable_diagnostics", this.diagnosticsSocketBinding != null);
this.setValue(protocol, "enable_diagnostics", this.diagnosticsSocketBinding != null);
if (this.diagnosticsSocketBinding != null) {
InetSocketAddress address = this.diagnosticsSocketBinding.get().getSocketAddress();
protocol.setValue("diagnostics_addr", address.getAddress());
protocol.setValue("diagnostics_port", address.getPort());
this.setValue(protocol, "diagnostics_addr", address.getAddress());
this.setValue(protocol, "diagnostics_port", address.getPort());
}
}

No commit comments for this range

You can’t perform that action at this time.