use of org.apache.pulsar.common.policies.data.FunctionStats in project pulsar by apache.
the class FunctionsImpl method getFunctionStatsAsync.
@Override
public CompletableFuture<FunctionStats> getFunctionStatsAsync(String tenant, String namespace, String function) {
WebTarget path = functions.path(tenant).path(namespace).path(function).path("stats");
final CompletableFuture<FunctionStats> future = new CompletableFuture<>();
asyncGetRequest(path, new InvocationCallback<Response>() {
@Override
public void completed(Response response) {
if (response.getStatus() != Response.Status.OK.getStatusCode()) {
future.completeExceptionally(getApiException(response));
} else {
future.complete(response.readEntity(FunctionStatsImpl.class));
}
}
@Override
public void failed(Throwable throwable) {
future.completeExceptionally(getApiException(throwable.getCause()));
}
});
return future;
}
use of org.apache.pulsar.common.policies.data.FunctionStats in project incubator-pulsar by apache.
the class FunctionsImpl method getFunctionStatsAsync.
@Override
public CompletableFuture<FunctionStats> getFunctionStatsAsync(String tenant, String namespace, String function) {
WebTarget path = functions.path(tenant).path(namespace).path(function).path("stats");
final CompletableFuture<FunctionStats> future = new CompletableFuture<>();
asyncGetRequest(path, new InvocationCallback<Response>() {
@Override
public void completed(Response response) {
if (response.getStatus() != Response.Status.OK.getStatusCode()) {
future.completeExceptionally(getApiException(response));
} else {
future.complete(response.readEntity(FunctionStatsImpl.class));
}
}
@Override
public void failed(Throwable throwable) {
future.completeExceptionally(getApiException(throwable.getCause()));
}
});
return future;
}
use of org.apache.pulsar.common.policies.data.FunctionStats in project pulsar by yahoo.
the class FunctionsImpl method getFunctionStatsAsync.
@Override
public CompletableFuture<FunctionStats> getFunctionStatsAsync(String tenant, String namespace, String function) {
WebTarget path = functions.path(tenant).path(namespace).path(function).path("stats");
final CompletableFuture<FunctionStats> future = new CompletableFuture<>();
asyncGetRequest(path, new InvocationCallback<Response>() {
@Override
public void completed(Response response) {
if (response.getStatus() != Response.Status.OK.getStatusCode()) {
future.completeExceptionally(getApiException(response));
} else {
future.complete(response.readEntity(FunctionStatsImpl.class));
}
}
@Override
public void failed(Throwable throwable) {
future.completeExceptionally(getApiException(throwable.getCause()));
}
});
return future;
}
Aggregations