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