Search in sources :

Example 1 with GetSchemaResponse

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

the class ServiceRegistryClientImpl method getSchema.

@Override
public String getSchema(String microserviceId, String schemaId) {
    Holder<GetSchemaResponse> holder = new Holder<>();
    IpPort ipPort = ipPortManager.getAvailableAddress();
    CountDownLatch countDownLatch = new CountDownLatch(1);
    RestUtils.get(ipPort, String.format(Const.REGISTRY_API.MICROSERVICE_SCHEMA, microserviceId, schemaId), new RequestParam(), syncHandler(countDownLatch, GetSchemaResponse.class, holder));
    try {
        countDownLatch.await();
    } catch (Exception e) {
        LOGGER.error("query schema exist {}/{} failed", microserviceId, schemaId, e);
    }
    if (holder.value != null) {
        return holder.value.getSchema();
    }
    return null;
}
Also used : Holder(javax.xml.ws.Holder) IpPort(org.apache.servicecomb.foundation.common.net.IpPort) GetSchemaResponse(org.apache.servicecomb.serviceregistry.api.response.GetSchemaResponse) 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 GetSchemaResponse (org.apache.servicecomb.serviceregistry.api.response.GetSchemaResponse)1 ClientException (org.apache.servicecomb.serviceregistry.client.ClientException)1