Search in sources :

Example 1 with Dependency

use of org.wildfly.clustering.service.Dependency in project wildfly by wildfly.

the class GlobalConfigurationServiceConfigurator method build.

@Override
public ServiceBuilder<?> build(ServiceTarget target) {
    ServiceBuilder<?> builder = target.addService(this.getServiceName());
    Consumer<GlobalConfiguration> global = new CompositeDependency(this.loader, this.modules, this.transport, this.server).register(builder).provides(this.getServiceName());
    for (Dependency dependency : this.pools.values()) {
        dependency.register(builder);
    }
    for (Dependency dependency : this.scheduledPools.values()) {
        dependency.register(builder);
    }
    Service service = new FunctionalService<>(global, Function.identity(), this);
    return builder.setInstance(service).setInitialMode(ServiceController.Mode.PASSIVE);
}
Also used : GlobalConfiguration(org.infinispan.configuration.global.GlobalConfiguration) FunctionalService(org.wildfly.clustering.service.FunctionalService) FunctionalService(org.wildfly.clustering.service.FunctionalService) Service(org.jboss.msc.Service) CompositeDependency(org.wildfly.clustering.service.CompositeDependency) CompositeDependency(org.wildfly.clustering.service.CompositeDependency) SupplierDependency(org.wildfly.clustering.service.SupplierDependency) ServiceSupplierDependency(org.wildfly.clustering.service.ServiceSupplierDependency) Dependency(org.wildfly.clustering.service.Dependency)

Example 2 with Dependency

use of org.wildfly.clustering.service.Dependency in project wildfly by wildfly.

the class CacheDependenciesProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext context) {
    DeploymentUnit unit = context.getDeploymentUnit();
    final ServiceName name = unit.getServiceName();
    EEModuleDescription moduleDescription = unit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
    if (moduleDescription == null) {
        return;
    }
    final CapabilityServiceSupport support = unit.getAttachment(org.jboss.as.server.deployment.Attachments.CAPABILITY_SERVICE_SUPPORT);
    final ServiceTarget target = context.getServiceTarget();
    Set<SupplierDependency<CacheFactoryBuilder<SessionID, StatefulSessionComponentInstance>>> dependencies = new HashSet<>();
    for (ComponentDescription description : moduleDescription.getComponentDescriptions()) {
        if (description instanceof StatefulComponentDescription) {
            StatefulComponentDescription statefulDescription = (StatefulComponentDescription) description;
            dependencies.add(new ServiceSupplierDependency<>(getCacheFactoryBuilderServiceName(statefulDescription)));
        }
    }
    Service service = new ChildTargetService(new Consumer<ServiceTarget>() {

        @Override
        public void accept(ServiceTarget target) {
            // Cache factory builder dependencies might still contain duplicates (if referenced via alias), so ensure we collect only distinct instances.
            Set<CacheFactoryBuilder<SessionID, StatefulSessionComponentInstance>> builders = new HashSet<>(dependencies.size());
            for (Supplier<CacheFactoryBuilder<SessionID, StatefulSessionComponentInstance>> dependency : dependencies) {
                builders.add(dependency.get());
            }
            for (CacheFactoryBuilder<SessionID, StatefulSessionComponentInstance> builder : builders) {
                for (CapabilityServiceConfigurator configurator : builder.getDeploymentServiceConfigurators(unit)) {
                    configurator.configure(support).build(target).install();
                }
            }
        }
    });
    ServiceBuilder<?> builder = target.addService(name.append("cache-dependencies-installer"));
    for (Dependency dependency : dependencies) {
        dependency.register(builder);
    }
    builder.setInstance(service).install();
    // Install versioned marshalling configuration
    new MarshallingConfigurationRepositoryServiceConfigurator(unit).build(target).setInitialMode(ServiceController.Mode.ON_DEMAND).install();
}
Also used : StatefulComponentDescription(org.jboss.as.ejb3.component.stateful.StatefulComponentDescription) ComponentDescription(org.jboss.as.ee.component.ComponentDescription) HashSet(java.util.HashSet) Set(java.util.Set) StatefulSessionComponentInstance(org.jboss.as.ejb3.component.stateful.StatefulSessionComponentInstance) CapabilityServiceSupport(org.jboss.as.controller.capability.CapabilityServiceSupport) CacheFactoryBuilder(org.jboss.as.ejb3.cache.CacheFactoryBuilder) EEModuleDescription(org.jboss.as.ee.component.EEModuleDescription) StatefulComponentDescription(org.jboss.as.ejb3.component.stateful.StatefulComponentDescription) Supplier(java.util.function.Supplier) HashSet(java.util.HashSet) CapabilityServiceConfigurator(org.jboss.as.clustering.controller.CapabilityServiceConfigurator) ChildTargetService(org.wildfly.clustering.service.ChildTargetService) ServiceTarget(org.jboss.msc.service.ServiceTarget) MarshallingConfigurationRepositoryServiceConfigurator(org.jboss.as.ejb3.component.stateful.MarshallingConfigurationRepositoryServiceConfigurator) Service(org.jboss.msc.Service) ChildTargetService(org.wildfly.clustering.service.ChildTargetService) SupplierDependency(org.wildfly.clustering.service.SupplierDependency) ServiceSupplierDependency(org.wildfly.clustering.service.ServiceSupplierDependency) Dependency(org.wildfly.clustering.service.Dependency) SupplierDependency(org.wildfly.clustering.service.SupplierDependency) ServiceSupplierDependency(org.wildfly.clustering.service.ServiceSupplierDependency) ServiceName(org.jboss.msc.service.ServiceName) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) SessionID(org.jboss.ejb.client.SessionID)

Example 3 with Dependency

use of org.wildfly.clustering.service.Dependency in project wildfly by wildfly.

the class ElectionPolicyServiceConfigurator method configure.

@Override
public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException {
    List<ModelNode> socketBindingPreferences = SOCKET_BINDING_PREFERENCES.resolveModelAttribute(context, model).asListOrEmpty();
    List<ModelNode> namePreferences = NAME_PREFERENCES.resolveModelAttribute(context, model).asListOrEmpty();
    List<Preference> preferences = new ArrayList<>(socketBindingPreferences.size() + namePreferences.size());
    List<Dependency> dependencies = new ArrayList<>(socketBindingPreferences.size());
    for (ModelNode preference : socketBindingPreferences) {
        SupplierDependency<OutboundSocketBinding> binding = new ServiceSupplierDependency<>(CommonUnaryRequirement.OUTBOUND_SOCKET_BINDING.getServiceName(context, preference.asString()));
        preferences.add(new OutboundSocketBindingPreference(binding));
        dependencies.add(binding);
    }
    for (ModelNode preference : namePreferences) {
        preferences.add(new NamePreference(preference.asString()));
    }
    this.dependencies = dependencies;
    this.preferences = preferences;
    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) OutboundSocketBindingPreference(org.wildfly.extension.clustering.singleton.election.OutboundSocketBindingPreference) Preference(org.wildfly.clustering.singleton.election.Preference) NamePreference(org.wildfly.clustering.singleton.election.NamePreference) ArrayList(java.util.ArrayList) SupplierDependency(org.wildfly.clustering.service.SupplierDependency) ServiceSupplierDependency(org.wildfly.clustering.service.ServiceSupplierDependency) Dependency(org.wildfly.clustering.service.Dependency) ServiceSupplierDependency(org.wildfly.clustering.service.ServiceSupplierDependency) ModelNode(org.jboss.dmr.ModelNode)

Example 4 with Dependency

use of org.wildfly.clustering.service.Dependency in project wildfly by wildfly.

the class RemoteCacheContainerConfigurationServiceConfigurator method build.

@Override
public ServiceBuilder<?> build(ServiceTarget target) {
    ServiceBuilder<?> builder = target.addService(this.getServiceName());
    Consumer<Configuration> configuration = new CompositeDependency(this.loader, this.modules, this.connectionPool, this.security, this.server).register(builder).provides(this.getServiceName());
    for (Dependency dependency : this.threadPools.values()) {
        dependency.register(builder);
    }
    for (List<SupplierDependency<OutboundSocketBinding>> dependencies : this.clusters.values()) {
        for (Dependency dependency : dependencies) {
            dependency.register(builder);
        }
    }
    Service service = new FunctionalService<>(configuration, Function.identity(), this);
    return builder.setInstance(service).setInitialMode(ServiceController.Mode.ON_DEMAND);
}
Also used : SecurityConfiguration(org.infinispan.client.hotrod.configuration.SecurityConfiguration) ExecutorFactoryConfiguration(org.infinispan.client.hotrod.configuration.ExecutorFactoryConfiguration) ConnectionPoolConfiguration(org.infinispan.client.hotrod.configuration.ConnectionPoolConfiguration) Configuration(org.infinispan.client.hotrod.configuration.Configuration) FunctionalService(org.wildfly.clustering.service.FunctionalService) Service(org.jboss.msc.Service) FunctionalService(org.wildfly.clustering.service.FunctionalService) CompositeDependency(org.wildfly.clustering.service.CompositeDependency) CompositeDependency(org.wildfly.clustering.service.CompositeDependency) SupplierDependency(org.wildfly.clustering.service.SupplierDependency) ServiceSupplierDependency(org.wildfly.clustering.service.ServiceSupplierDependency) Dependency(org.wildfly.clustering.service.Dependency) SupplierDependency(org.wildfly.clustering.service.SupplierDependency) ServiceSupplierDependency(org.wildfly.clustering.service.ServiceSupplierDependency)

Example 5 with Dependency

use of org.wildfly.clustering.service.Dependency in project wildfly by wildfly.

the class JChannelFactoryServiceConfigurator method build.

@Override
public ServiceBuilder<?> build(ServiceTarget target) {
    ServiceBuilder<?> builder = target.addService(this.getServiceName());
    Consumer<ChannelFactory> factory = new CompositeDependency(this.transport, this.relay, this.socketBindingManager).register(builder).provides(this.getServiceName());
    this.environment = builder.requires(ServerEnvironmentService.SERVICE_NAME);
    for (Dependency dependency : this.protocols) {
        dependency.register(builder);
    }
    Service service = Service.newInstance(factory, new JChannelFactory(this));
    return builder.setInstance(service).setInitialMode(ServiceController.Mode.ON_DEMAND);
}
Also used : ServerEnvironmentService(org.jboss.as.server.ServerEnvironmentService) Service(org.jboss.msc.Service) JChannelFactory(org.jboss.as.clustering.jgroups.JChannelFactory) CompositeDependency(org.wildfly.clustering.service.CompositeDependency) CompositeDependency(org.wildfly.clustering.service.CompositeDependency) SupplierDependency(org.wildfly.clustering.service.SupplierDependency) ServiceSupplierDependency(org.wildfly.clustering.service.ServiceSupplierDependency) Dependency(org.wildfly.clustering.service.Dependency) JChannelFactory(org.jboss.as.clustering.jgroups.JChannelFactory) ChannelFactory(org.wildfly.clustering.jgroups.spi.ChannelFactory)

Aggregations

Dependency (org.wildfly.clustering.service.Dependency)8 ServiceSupplierDependency (org.wildfly.clustering.service.ServiceSupplierDependency)8 SupplierDependency (org.wildfly.clustering.service.SupplierDependency)8 Service (org.jboss.msc.Service)7 CompositeDependency (org.wildfly.clustering.service.CompositeDependency)5 FunctionalService (org.wildfly.clustering.service.FunctionalService)5 ChannelFactory (org.wildfly.clustering.jgroups.spi.ChannelFactory)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 Supplier (java.util.function.Supplier)1 Configuration (org.infinispan.client.hotrod.configuration.Configuration)1 ConnectionPoolConfiguration (org.infinispan.client.hotrod.configuration.ConnectionPoolConfiguration)1 ExecutorFactoryConfiguration (org.infinispan.client.hotrod.configuration.ExecutorFactoryConfiguration)1 SecurityConfiguration (org.infinispan.client.hotrod.configuration.SecurityConfiguration)1 GlobalConfiguration (org.infinispan.configuration.global.GlobalConfiguration)1 CapabilityServiceConfigurator (org.jboss.as.clustering.controller.CapabilityServiceConfigurator)1 ForkChannelFactory (org.jboss.as.clustering.jgroups.ForkChannelFactory)1 JChannelFactory (org.jboss.as.clustering.jgroups.JChannelFactory)1 CapabilityServiceSupport (org.jboss.as.controller.capability.CapabilityServiceSupport)1