use of org.wildfly.clustering.spi.GroupBuilderProvider in project wildfly by wildfly.
the class InfinispanSubsystemServiceHandler method installServices.
@Override
public void installServices(OperationContext context, ModelNode model) throws OperationFailedException {
InfinispanLogger.ROOT_LOGGER.activatingSubsystem();
PathAddress address = context.getCurrentAddress();
ServiceTarget target = context.getServiceTarget();
// Install local group services
for (GroupBuilderProvider provider : ServiceLoader.load(LocalGroupBuilderProvider.class, LocalGroupBuilderProvider.class.getClassLoader())) {
InfinispanLogger.ROOT_LOGGER.debugf("Installing %s for %s group", provider.getClass().getSimpleName(), LocalGroupBuilderProvider.LOCAL);
for (CapabilityServiceBuilder<?> builder : provider.getBuilders(requirement -> LOCAL_CLUSTERING_CAPABILITIES.get(requirement).getServiceName(address), LocalGroupBuilderProvider.LOCAL)) {
builder.configure(context).build(target).install();
}
}
// If JGroups subsystem is not available, install default group aliases to local group.
if (!context.hasOptionalCapability(JGroupsRequirement.CHANNEL.getDefaultRequirement().getName(), null, null)) {
for (GroupAliasBuilderProvider provider : ServiceLoader.load(GroupAliasBuilderProvider.class, GroupAliasBuilderProvider.class.getClassLoader())) {
for (CapabilityServiceBuilder<?> builder : provider.getBuilders(requirement -> CLUSTERING_CAPABILITIES.get(requirement).getServiceName(address), null, LocalGroupBuilderProvider.LOCAL)) {
builder.configure(context).build(target).install();
}
}
}
}
use of org.wildfly.clustering.spi.GroupBuilderProvider in project wildfly by wildfly.
the class ChannelServiceHandler method installServices.
@Override
public void installServices(OperationContext context, ModelNode model) throws OperationFailedException {
PathAddress address = context.getCurrentAddress();
String name = context.getCurrentAddressValue();
String stack = STACK.resolveModelAttribute(context, model).asString();
ServiceTarget target = context.getServiceTarget();
new ChannelClusterBuilder(JCHANNEL_CLUSTER.getServiceName(address), name).configure(context, model).build(target).install();
new ChannelBuilder(JCHANNEL.getServiceName(address), name).statisticsEnabled(STATISTICS_ENABLED.resolveModelAttribute(context, model).asBoolean()).configure(context, model).build(target).install();
new AliasServiceBuilder<>(JCHANNEL_FACTORY.getServiceName(address), JGroupsRequirement.CHANNEL_FACTORY.getServiceName(context, stack), JGroupsRequirement.CHANNEL_FACTORY.getType()).build(target).install();
new ForkChannelFactoryBuilder(FORK_CHANNEL_FACTORY.getServiceName(address), name).configure(context, model).build(target).install();
new ModuleBuilder(JCHANNEL_MODULE.getServiceName(address), MODULE).configure(context, model).build(target).install();
new BinderServiceBuilder<>(JGroupsBindingFactory.createChannelBinding(name), JGroupsRequirement.CHANNEL.getServiceName(context, name), JGroupsRequirement.CHANNEL.getType()).build(target).install();
new BinderServiceBuilder<>(JGroupsBindingFactory.createChannelFactoryBinding(name), JGroupsRequirement.CHANNEL_FACTORY.getServiceName(context, name), JGroupsRequirement.CHANNEL_FACTORY.getType()).build(target).install();
// Install group services for channel
for (GroupBuilderProvider provider : ServiceLoader.load(DistributedGroupBuilderProvider.class, DistributedGroupBuilderProvider.class.getClassLoader())) {
for (CapabilityServiceBuilder<?> builder : provider.getBuilders(requirement -> CLUSTERING_CAPABILITIES.get(requirement).getServiceName(address), name)) {
JGroupsLogger.ROOT_LOGGER.debugf("Installing %s for channel %s", builder.getServiceName(), name);
builder.configure(context).build(target).install();
}
}
}
use of org.wildfly.clustering.spi.GroupBuilderProvider in project wildfly by wildfly.
the class ChannelServiceHandler method removeServices.
@Override
public void removeServices(OperationContext context, ModelNode model) throws OperationFailedException {
PathAddress address = context.getCurrentAddress();
String name = context.getCurrentAddressValue();
EnumSet.allOf(Capability.class).forEach(capability -> context.removeService(capability.getServiceName(address)));
context.removeService(JGroupsBindingFactory.createChannelBinding(name).getBinderServiceName());
context.removeService(JGroupsBindingFactory.createChannelFactoryBinding(name).getBinderServiceName());
for (GroupBuilderProvider provider : ServiceLoader.load(DistributedGroupBuilderProvider.class, DistributedGroupBuilderProvider.class.getClassLoader())) {
for (ServiceNameProvider builder : provider.getBuilders(requirement -> CLUSTERING_CAPABILITIES.get(requirement).getServiceName(address), name)) {
JGroupsLogger.ROOT_LOGGER.debugf("Removing %s for channel %s", builder.getServiceName(), name);
context.removeService(builder.getServiceName());
}
}
}
use of org.wildfly.clustering.spi.GroupBuilderProvider in project wildfly by wildfly.
the class EJB3RemoteServiceAdd method installRuntimeServices.
void installRuntimeServices(final OperationContext context, final ModelNode model) throws OperationFailedException {
final String clientMappingsClusterName = EJB3RemoteResourceDefinition.CLIENT_MAPPINGS_CLUSTER_NAME.resolveModelAttribute(context, model).asString();
final String connectorName = EJB3RemoteResourceDefinition.CONNECTOR_REF.resolveModelAttribute(context, model).asString();
final ServiceName remotingServerInfoServiceName = RemotingConnectorBindingInfoService.serviceName(connectorName);
final String threadPoolName = EJB3RemoteResourceDefinition.THREAD_POOL_NAME.resolveModelAttribute(context, model).asString();
final boolean executeInWorker = EJB3RemoteResourceDefinition.EXECUTE_IN_WORKER.resolveModelAttribute(context, model).asBoolean();
final ServiceTarget target = context.getServiceTarget();
// Install the client-mapping service for the remoting connector
new EJBRemotingConnectorClientMappingsEntryProviderService(clientMappingsClusterName, remotingServerInfoServiceName).configure(context).build(target).setInitialMode(ServiceController.Mode.ON_DEMAND).install();
new RegistryInstallerService(clientMappingsClusterName).configure(context).build(target).setInitialMode(ServiceController.Mode.ON_DEMAND).install();
// Handle case where no infinispan subsystem exists or does not define an ejb cache-container
Resource rootResource = context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS);
PathElement infinispanPath = PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, "infinispan");
if (!rootResource.hasChild(infinispanPath) || !rootResource.getChild(infinispanPath).hasChild(PathElement.pathElement("cache-container", clientMappingsClusterName))) {
// Install services that would normally be installed by this container/cache
CapabilityServiceSupport support = context.getCapabilityServiceSupport();
for (GroupBuilderProvider provider : ServiceLoader.load(LocalGroupBuilderProvider.class, LocalGroupBuilderProvider.class.getClassLoader())) {
for (CapabilityServiceBuilder<?> builder : provider.getBuilders(requirement -> requirement.getServiceName(support, clientMappingsClusterName), clientMappingsClusterName)) {
builder.configure(support).build(target).install();
}
}
for (CacheBuilderProvider provider : ServiceLoader.load(LocalCacheBuilderProvider.class, LocalCacheBuilderProvider.class.getClassLoader())) {
for (CapabilityServiceBuilder<?> builder : provider.getBuilders(requirement -> requirement.getServiceName(support, clientMappingsClusterName, null), clientMappingsClusterName, null)) {
builder.configure(support).build(target).install();
}
}
}
final OptionMap channelCreationOptions = this.getChannelCreationOptions(context);
// Install the EJB remoting connector service which will listen for client connections on the remoting channel
// TODO: Externalize (expose via management API if needed) the version and the marshalling strategy
final EJBRemoteConnectorService ejbRemoteConnectorService = new EJBRemoteConnectorService(channelCreationOptions);
ServiceBuilder<EJBRemoteConnectorService> builder = target.addService(EJBRemoteConnectorService.SERVICE_NAME, ejbRemoteConnectorService);
builder.addDependency(RemotingServices.SUBSYSTEM_ENDPOINT, Endpoint.class, ejbRemoteConnectorService.getEndpointInjector()).addDependency(remotingServerInfoServiceName, RemotingConnectorBindingInfoService.RemotingConnectorInfo.class, ejbRemoteConnectorService.getRemotingConnectorInfoInjectedValue()).addDependency(AssociationService.SERVICE_NAME, AssociationService.class, ejbRemoteConnectorService.getAssociationServiceInjector()).addDependency(TxnServices.JBOSS_TXN_REMOTE_TRANSACTION_SERVICE, RemotingTransactionService.class, ejbRemoteConnectorService.getRemotingTransactionServiceInjector()).addDependency(ControlledProcessStateService.SERVICE_NAME, ControlledProcessStateService.class, ejbRemoteConnectorService.getControlledProcessStateServiceInjector()).setInitialMode(ServiceController.Mode.ACTIVE);
if (!executeInWorker) {
builder.addDependency(EJB3SubsystemModel.BASE_THREAD_POOL_SERVICE_NAME.append(threadPoolName), ExecutorService.class, ejbRemoteConnectorService.getExecutorService());
}
builder.install();
}
Aggregations