Search in sources :

Example 1 with GetSchemaResponse

use of io.servicecomb.serviceregistry.api.response.GetSchemaResponse in project java-chassis by ServiceComb.

the class ServiceRegistryClientImpl method getSchema.

@Override
public String getSchema(String microserviceId, String schemaId) {
    Holder<GetSchemaResponse> holder = new Holder<>();
    IpPort ipPort = IpPortManager.INSTANCE.get();
    CountDownLatch countDownLatch = new CountDownLatch(1);
    RestUtils.get(ipPort, Const.MS_API_PATH + Const.MICROSERVICE_PATH + "/" + microserviceId + Const.SCHEMA_PATH + "/" + 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(io.servicecomb.foundation.common.net.IpPort) GetSchemaResponse(io.servicecomb.serviceregistry.api.response.GetSchemaResponse) CountDownLatch(java.util.concurrent.CountDownLatch) ClientException(io.servicecomb.serviceregistry.client.ClientException)

Aggregations

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