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);
}
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();
}
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;
}
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);
}
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);
}
Aggregations