use of org.wildfly.clustering.jgroups.spi.RemoteSiteConfiguration in project wildfly by wildfly.
the class RemoteSiteConfigurationServiceConfigurator method build.
@Override
public ServiceBuilder<?> build(ServiceTarget target) {
ServiceBuilder<?> builder = target.addService(this.getServiceName());
Consumer<RemoteSiteConfiguration> configuration = new CompositeDependency(this.cluster, this.factory).register(builder).provides(this.getServiceName());
Service service = Service.newInstance(configuration, this);
return builder.setInstance(service).setInitialMode(ServiceController.Mode.ON_DEMAND);
}
use of org.wildfly.clustering.jgroups.spi.RemoteSiteConfiguration in project wildfly by wildfly.
the class RelayConfigurationBuilder method accept.
@Override
public void accept(RELAY2 protocol) {
String localSite = this.siteName;
List<RemoteSiteConfiguration> remoteSites = this.getRemoteSites();
List<String> sites = new ArrayList<>(remoteSites.size() + 1);
sites.add(localSite);
// Collect bridges, eliminating duplicates
Map<String, RelayConfig.BridgeConfig> bridges = new HashMap<>();
for (final RemoteSiteConfiguration remoteSite : remoteSites) {
String siteName = remoteSite.getName();
sites.add(siteName);
String clusterName = remoteSite.getClusterName();
RelayConfig.BridgeConfig bridge = new RelayConfig.BridgeConfig(clusterName) {
@Override
public JChannel createChannel() throws Exception {
JChannel channel = (JChannel) remoteSite.getChannelFactory().createChannel(siteName);
// Don't use FORK in bridge stack
channel.getProtocolStack().removeProtocol(FORK.class);
return channel;
}
};
bridges.put(clusterName, bridge);
}
protocol.site(localSite);
for (String site : sites) {
RelayConfig.SiteConfig siteConfig = new RelayConfig.SiteConfig(site);
protocol.addSite(site, siteConfig);
if (site.equals(localSite)) {
for (RelayConfig.BridgeConfig bridge : bridges.values()) {
siteConfig.addBridge(bridge);
}
}
}
}
use of org.wildfly.clustering.jgroups.spi.RemoteSiteConfiguration in project wildfly by wildfly.
the class RelayConfigurationServiceConfigurator method accept.
@Override
public void accept(RELAY2 protocol) {
String localSite = this.siteName;
List<RemoteSiteConfiguration> remoteSites = this.getRemoteSites();
List<String> sites = new ArrayList<>(remoteSites.size() + 1);
sites.add(localSite);
// Collect bridges, eliminating duplicates
Map<String, RelayConfig.BridgeConfig> bridges = new HashMap<>();
for (final RemoteSiteConfiguration remoteSite : remoteSites) {
String siteName = remoteSite.getName();
sites.add(siteName);
String clusterName = remoteSite.getClusterName();
RelayConfig.BridgeConfig bridge = new RelayConfig.BridgeConfig(clusterName) {
@Override
public JChannel createChannel() throws Exception {
JChannel channel = remoteSite.getChannelFactory().createChannel(siteName);
// Don't use FORK in bridge stack
channel.getProtocolStack().removeProtocol(FORK.class);
return channel;
}
};
bridges.put(clusterName, bridge);
}
protocol.site(localSite);
for (String site : sites) {
RelayConfig.SiteConfig siteConfig = new RelayConfig.SiteConfig(site);
protocol.addSite(site, siteConfig);
if (site.equals(localSite)) {
for (RelayConfig.BridgeConfig bridge : bridges.values()) {
siteConfig.addBridge(bridge);
}
}
}
}
Aggregations