Package com.netflix.eureka.util.StatusInfo

Examples of com.netflix.eureka.util.StatusInfo.Builder


    private final PeerAwareInstanceRegistry registry = PeerAwareInstanceRegistry
    .getInstance();

    @GET
    public StatusInfo getStatusInfo() {
        Builder builder = Builder.newBuilder();
        // Add application level status
        StringBuilder upReplicas = new StringBuilder();
        StringBuilder downReplicas = new StringBuilder();

        StringBuilder replicaHostNames = new StringBuilder();
        String myAppName = ApplicationInfoManager.getInstance().getInfo()
        .getAppName();

        for (PeerEurekaNode node : registry.getReplicaNodes()) {
            if (replicaHostNames.length() > 0) {
                replicaHostNames.append(", ");
            }
            replicaHostNames.append(node.getServiceUrl());
            if (isReplicaAvailable(myAppName, node.getServiceUrl())) {
                upReplicas.append(node.getServiceUrl()).append(',');
            } else {
                downReplicas.append(node.getServiceUrl()).append(',');
            }
        }

        builder.add("registered-replicas", replicaHostNames.toString());
        builder.add("available-replicas", upReplicas.toString());
        builder.add("unavailable-replicas", downReplicas.toString());

        return builder.build();
    }
View Full Code Here

TOP

Related Classes of com.netflix.eureka.util.StatusInfo.Builder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.