Search in sources :

Example 1 with GetAllServicesResponse

use of org.apache.servicecomb.serviceregistry.api.response.GetAllServicesResponse in project incubator-servicecomb-java-chassis by apache.

the class ServiceRegistryClientImpl method getAllMicroservices.

@Override
public List<Microservice> getAllMicroservices() {
    Holder<GetAllServicesResponse> holder = new Holder<>();
    IpPort ipPort = ipPortManager.getAvailableAddress();
    CountDownLatch countDownLatch = new CountDownLatch(1);
    RestUtils.get(ipPort, Const.REGISTRY_API.MICROSERVICE_OPERATION_ALL, new RequestParam(), syncHandler(countDownLatch, GetAllServicesResponse.class, holder));
    try {
        countDownLatch.await();
        if (holder.value != null) {
            return holder.value.getServices();
        }
    } catch (Exception e) {
        LOGGER.error("query all microservices failed", e);
    }
    return emptyList();
}
Also used : GetAllServicesResponse(org.apache.servicecomb.serviceregistry.api.response.GetAllServicesResponse) Holder(javax.xml.ws.Holder) IpPort(org.apache.servicecomb.foundation.common.net.IpPort) CountDownLatch(java.util.concurrent.CountDownLatch) ClientException(org.apache.servicecomb.serviceregistry.client.ClientException)

Aggregations

CountDownLatch (java.util.concurrent.CountDownLatch)1 Holder (javax.xml.ws.Holder)1 IpPort (org.apache.servicecomb.foundation.common.net.IpPort)1 GetAllServicesResponse (org.apache.servicecomb.serviceregistry.api.response.GetAllServicesResponse)1 ClientException (org.apache.servicecomb.serviceregistry.client.ClientException)1