Search in sources :

Example 1 with ModClusterStatus

use of io.undertow.server.handlers.proxy.mod_cluster.ModClusterStatus in project wildfly by wildfly.

the class ModClusterResource method getChildrenNames.

@Override
public Set<String> getChildrenNames(final String childType) {
    if (BALANCER.equals(childType)) {
        ModClusterService service = service(name);
        if (service == null) {
            return Collections.emptySet();
        }
        ModCluster modCluster = service.getModCluster();
        if (modCluster == null) {
            return Collections.emptySet();
        }
        ModClusterController controller = modCluster.getController();
        if (controller == null) {
            return Collections.emptySet();
        }
        ModClusterStatus status = controller.getStatus();
        final Set<String> result = new LinkedHashSet<>();
        for (ModClusterStatus.LoadBalancer balancer : status.getLoadBalancers()) {
            result.add(balancer.getName());
        }
        return result;
    }
    return delegate.getChildrenNames(childType);
}
Also used : LinkedHashSet(java.util.LinkedHashSet) ModCluster(io.undertow.server.handlers.proxy.mod_cluster.ModCluster) ModClusterController(io.undertow.server.handlers.proxy.mod_cluster.ModClusterController) ModClusterStatus(io.undertow.server.handlers.proxy.mod_cluster.ModClusterStatus)

Example 2 with ModClusterStatus

use of io.undertow.server.handlers.proxy.mod_cluster.ModClusterStatus in project wildfly by wildfly.

the class ModClusterBalancerResource method getChildrenNames.

@Override
public Set<String> getChildrenNames(final String childType) {
    if (NODE.equals(childType)) {
        ModClusterService service = ModClusterResource.service(modClusterName);
        if (service == null) {
            return Collections.emptySet();
        }
        ModCluster modCluster = service.getModCluster();
        ModClusterStatus status = modCluster.getController().getStatus();
        final Set<String> result = new LinkedHashSet<>();
        ModClusterStatus.LoadBalancer balancer = status.getLoadBalancer(this.name);
        for (ModClusterStatus.Node node : balancer.getNodes()) {
            result.add(node.getName());
        }
        return result;
    } else if (LOAD_BALANCING_GROUP.equals(childType)) {
        ModClusterService service = ModClusterResource.service(modClusterName);
        if (service == null) {
            return Collections.emptySet();
        }
        ModCluster modCluster = service.getModCluster();
        ModClusterStatus status = modCluster.getController().getStatus();
        final Set<String> result = new LinkedHashSet<>();
        ModClusterStatus.LoadBalancer balancer = status.getLoadBalancer(this.name);
        for (ModClusterStatus.Node node : balancer.getNodes()) {
            result.add(node.getDomain());
        }
        return result;
    }
    return null;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) Set(java.util.Set) LinkedHashSet(java.util.LinkedHashSet) ModCluster(io.undertow.server.handlers.proxy.mod_cluster.ModCluster) ModelNode(org.jboss.dmr.ModelNode) ModClusterStatus(io.undertow.server.handlers.proxy.mod_cluster.ModClusterStatus)

Example 3 with ModClusterStatus

use of io.undertow.server.handlers.proxy.mod_cluster.ModClusterStatus in project wildfly by wildfly.

the class ModClusterNodeResource method getChildrenNames.

@Override
public Set<String> getChildrenNames(final String childType) {
    if (CONTEXT.equals(childType)) {
        ModClusterService service = ModClusterResource.service(modClusterName);
        if (service == null) {
            return Collections.emptySet();
        }
        ModCluster modCluster = service.getModCluster();
        ModClusterStatus status = modCluster.getController().getStatus();
        final Set<String> result = new LinkedHashSet<>();
        ModClusterStatus.LoadBalancer balancer = status.getLoadBalancer(this.balancerName);
        ModClusterStatus.Node node = balancer.getNode(this.name);
        for (ModClusterStatus.Context context : node.getContexts()) {
            result.add(context.getName());
        }
        return result;
    }
    return null;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) ModCluster(io.undertow.server.handlers.proxy.mod_cluster.ModCluster) ModClusterStatus(io.undertow.server.handlers.proxy.mod_cluster.ModClusterStatus)

Aggregations

ModCluster (io.undertow.server.handlers.proxy.mod_cluster.ModCluster)3 ModClusterStatus (io.undertow.server.handlers.proxy.mod_cluster.ModClusterStatus)3 LinkedHashSet (java.util.LinkedHashSet)3 ModClusterController (io.undertow.server.handlers.proxy.mod_cluster.ModClusterController)1 Set (java.util.Set)1 ModelNode (org.jboss.dmr.ModelNode)1