use of org.wildfly.clustering.jgroups.spi.ProtocolStackConfiguration in project wildfly by wildfly.
the class ProtocolResourceRegistrationHandler method findProtocol.
@Override
public Protocol findProtocol(OperationContext context) throws ClassNotFoundException, ModuleLoadException {
PathAddress address = context.getCurrentAddress();
String channelName = address.getParent().getLastElement().getValue();
String protocolName = address.getLastElement().getValue();
ServiceRegistry registry = context.getServiceRegistry(false);
ServiceController<?> controller = registry.getService(JGroupsRequirement.CHANNEL.getServiceName(context, channelName));
if (controller != null) {
Channel channel = (Channel) controller.getValue();
if (channel != null) {
controller = registry.getService(JGroupsRequirement.CHANNEL_SOURCE.getServiceName(context, channelName));
ChannelFactory factory = (ChannelFactory) controller.getValue();
if (factory != null) {
ProtocolStackConfiguration configuration = factory.getProtocolStackConfiguration();
ProtocolConfiguration<? extends TP> transport = configuration.getTransport();
if (transport.getName().equals(protocolName)) {
Class<? extends Protocol> protocolClass = transport.createProtocol().getClass();
return channel.getProtocolStack().findProtocol(protocolClass);
}
for (ProtocolConfiguration<? extends Protocol> protocol : configuration.getProtocols()) {
if (protocol.getName().equals(protocolName)) {
Class<? extends Protocol> protocolClass = protocol.createProtocol().getClass();
return channel.getProtocolStack().findProtocol(protocolClass);
}
}
}
}
}
return null;
}
use of org.wildfly.clustering.jgroups.spi.ProtocolStackConfiguration in project wildfly by wildfly.
the class ForkProtocolResourceRegistrationHandler method findProtocol.
@Override
public Protocol findProtocol(OperationContext context) throws ClassNotFoundException, ModuleLoadException {
PathAddress address = context.getCurrentAddress();
String channelName = address.getElement(address.size() - 3).getValue();
String forkName = address.getElement(address.size() - 2).getValue();
String protocolName = address.getElement(address.size() - 1).getValue();
ServiceRegistry registry = context.getServiceRegistry(false);
ServiceController<?> controller = registry.getService(JGroupsRequirement.CHANNEL.getServiceName(context, channelName));
if (controller != null) {
Channel channel = (Channel) controller.getValue();
if (channel != null) {
FORK fork = (FORK) channel.getProtocolStack().findProtocol(FORK.class);
if (fork != null) {
controller = registry.getService(JGroupsRequirement.CHANNEL_FACTORY.getServiceName(context, channelName));
if (controller != null) {
ChannelFactory factory = (ChannelFactory) controller.getValue();
if (factory != null) {
ProtocolStackConfiguration configuration = factory.getProtocolStackConfiguration();
ProtocolConfiguration<? extends TP> transport = configuration.getTransport();
if (transport.getName().equals(protocolName)) {
Class<? extends Protocol> protocolClass = transport.createProtocol().getClass();
return channel.getProtocolStack().findProtocol(protocolClass);
}
for (ProtocolConfiguration<? extends Protocol> protocol : configuration.getProtocols()) {
if (protocol.getName().equals(protocolName)) {
Class<? extends Protocol> protocolClass = protocol.createProtocol().getClass();
return fork.get(forkName).getProtocolStack().findProtocol(protocolClass);
}
}
}
}
}
}
}
return null;
}
use of org.wildfly.clustering.jgroups.spi.ProtocolStackConfiguration in project wildfly by wildfly.
the class JGroupsTransportBuilder method getValue.
@Override
public TransportConfiguration getValue() {
ChannelFactory factory = this.factory.getValue();
ProtocolStackConfiguration stack = factory.getProtocolStackConfiguration();
org.wildfly.clustering.jgroups.spi.TransportConfiguration.Topology topology = stack.getTransport().getTopology();
TransportConfigurationBuilder builder = new GlobalConfigurationBuilder().transport().clusterName(this.containerName).distributedSyncTimeout(this.lockTimeout).transport(new ChannelFactoryTransport(factory));
if (topology != null) {
builder.siteId(topology.getSite()).rackId(topology.getRack()).machineId(topology.getMachine());
}
return builder.create();
}
use of org.wildfly.clustering.jgroups.spi.ProtocolStackConfiguration in project wildfly by wildfly.
the class JGroupsTransportServiceConfigurator method get.
@Override
public TransportConfiguration get() {
ChannelFactory factory = this.factory.get();
Properties properties = new Properties();
properties.put(JGroupsTransport.CHANNEL_CONFIGURATOR, new ChannelConfigurator(factory, this.containerName));
ProtocolStackConfiguration stack = factory.getProtocolStackConfiguration();
org.wildfly.clustering.jgroups.spi.TransportConfiguration.Topology topology = stack.getTransport().getTopology();
TransportConfigurationBuilder builder = new GlobalConfigurationBuilder().transport().clusterName(this.cluster.get()).distributedSyncTimeout(this.lockTimeout).transport(new JGroupsTransport()).withProperties(properties);
if (topology != null) {
builder.siteId(topology.getSite()).rackId(topology.getRack()).machineId(topology.getMachine());
}
return builder.create();
}
Aggregations