use of org.apache.pulsar.common.policies.data.FunctionInstanceStatsData in project pulsar by yahoo.
the class FunctionsImpl method getFunctionStatsAsync.
@Override
public CompletableFuture<FunctionInstanceStatsData> getFunctionStatsAsync(String tenant, String namespace, String function, int id) {
WebTarget path = functions.path(tenant).path(namespace).path(function).path(Integer.toString(id)).path("stats");
final CompletableFuture<FunctionInstanceStatsData> 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(FunctionInstanceStatsDataImpl.class));
}
}
@Override
public void failed(Throwable throwable) {
future.completeExceptionally(getApiException(throwable.getCause()));
}
});
return future;
}
use of org.apache.pulsar.common.policies.data.FunctionInstanceStatsData in project incubator-pulsar by apache.
the class FunctionsImpl method getFunctionStatsAsync.
@Override
public CompletableFuture<FunctionInstanceStatsData> getFunctionStatsAsync(String tenant, String namespace, String function, int id) {
WebTarget path = functions.path(tenant).path(namespace).path(function).path(Integer.toString(id)).path("stats");
final CompletableFuture<FunctionInstanceStatsData> 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(FunctionInstanceStatsDataImpl.class));
}
}
@Override
public void failed(Throwable throwable) {
future.completeExceptionally(getApiException(throwable.getCause()));
}
});
return future;
}
use of org.apache.pulsar.common.policies.data.FunctionInstanceStatsData in project pulsar by apache.
the class FunctionsImpl method getFunctionStatsAsync.
@Override
public CompletableFuture<FunctionInstanceStatsData> getFunctionStatsAsync(String tenant, String namespace, String function, int id) {
WebTarget path = functions.path(tenant).path(namespace).path(function).path(Integer.toString(id)).path("stats");
final CompletableFuture<FunctionInstanceStatsData> 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(FunctionInstanceStatsDataImpl.class));
}
}
@Override
public void failed(Throwable throwable) {
future.completeExceptionally(getApiException(throwable.getCause()));
}
});
return future;
}
Aggregations