use of org.wildfly.clustering.service.FunctionSupplierDependency in project wildfly by wildfly.
the class UndertowDistributableServerRuntimeHandler method execute.
@Override
public void execute(OperationContext context, String serverName) {
SupplierDependency<RoutingProvider> provider = getRoutingProvider(context, serverName);
if (provider != null) {
ServiceTarget target = context.getServiceTarget();
CapabilityServiceSupport support = context.getCapabilityServiceSupport();
SupplierDependency<Server> server = new ServiceSupplierDependency<>(UndertowUnaryRequirement.SERVER.getServiceName(context, serverName));
SupplierDependency<String> route = new FunctionSupplierDependency<>(server, Server::getRoute);
Consumer<ServiceTarget> installer = new Consumer<ServiceTarget>() {
@Override
public void accept(ServiceTarget target) {
for (CapabilityServiceConfigurator configurator : provider.get().getServiceConfigurators(serverName, route)) {
configurator.configure(support).build(target).install();
}
}
};
ServiceName name = ServiceName.JBOSS.append("clustering", "web", "undertow", "routing", serverName);
provider.register(target.addService(name)).setInstance(new ChildTargetService(installer)).install();
}
}
Aggregations