本文整理了Java中com.facebook.presto.execution.QueryManager.recordHeartbeat
方法的一些代码示例,展示了QueryManager.recordHeartbeat
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QueryManager.recordHeartbeat
方法的具体详情如下:
包路径:com.facebook.presto.execution.QueryManager
类名称:QueryManager
方法名:recordHeartbeat
[英]Updates the client heartbeat time, to prevent the query from be automatically purged. If the query does not exist, the call is ignored.
[中]更新客户端心跳时间,以防止自动清除查询。如果查询不存在,则忽略该调用。
代码示例来源:origin: prestodb/presto
private synchronized Optional<QueryResults> getCachedResult(long token, UriInfo uriInfo)
{
// is the a repeated request for the last results?
String requestedPath = uriInfo.getAbsolutePath().getPath();
if (requestedPath.equals(lastResultPath)) {
if (submissionFuture.isDone()) {
// tell query manager we are still interested in the query
queryManager.recordHeartbeat(queryId);
}
return Optional.of(lastResult);
}
if (token < resultId.get()) {
throw new WebApplicationException(Response.Status.GONE);
}
// if this is not a request for the next results, return not found
if (lastResult.getNextUri() == null || !requestedPath.equals(lastResult.getNextUri().getPath())) {
// unknown token
throw new WebApplicationException(Response.Status.NOT_FOUND);
}
return Optional.empty();
}
代码示例来源:origin: prestodb/presto
private synchronized ListenableFuture<?> getFutureStateChange()
{
// ensure the query has been submitted
submissionFuture.submitQuery();
// if query query submission has not finished, wait for it to finish
if (!submissionFuture.isDone()) {
return submissionFuture;
}
// if the exchange client is open, wait for data
if (!exchangeClient.isClosed()) {
return exchangeClient.isBlocked();
}
// otherwise, wait for the query to finish
queryManager.recordHeartbeat(queryId);
try {
return queryDoneFuture(queryManager.getQueryState(queryId));
}
catch (NoSuchElementException e) {
return immediateFuture(null);
}
}
代码示例来源:origin: prestodb/presto
public static void waitForQueryState(DistributedQueryRunner queryRunner, QueryId queryId, Set<QueryState> expectedQueryStates)
throws InterruptedException
{
QueryManager queryManager = queryRunner.getCoordinator().getQueryManager();
do {
// Heartbeat all the running queries, so they don't die while we're waiting
for (BasicQueryInfo queryInfo : queryManager.getQueries()) {
if (queryInfo.getState() == RUNNING) {
queryManager.recordHeartbeat(queryInfo.getQueryId());
}
}
MILLISECONDS.sleep(500);
}
while (!expectedQueryStates.contains(queryManager.getQueryState(queryId)));
}
代码示例来源:origin: prestodb/presto
queryManager.recordHeartbeat(queryId);
代码示例来源:origin: uk.co.nichesolutions.presto/presto-main
public synchronized QueryResults getResults(long token, UriInfo uriInfo, Duration maxWaitTime)
throws InterruptedException
{
// is the a repeated request for the last results?
String requestedPath = uriInfo.getAbsolutePath().getPath();
if (lastResultPath != null && requestedPath.equals(lastResultPath)) {
// tell query manager we are still interested in the query
queryManager.getQueryInfo(queryId);
queryManager.recordHeartbeat(queryId);
return lastResult;
}
if (token < resultId.get()) {
throw new WebApplicationException(Status.GONE);
}
// if this is not a request for the next results, return not found
if (lastResult.getNextUri() == null || !requestedPath.equals(lastResult.getNextUri().getPath())) {
// unknown token
throw new WebApplicationException(Status.NOT_FOUND);
}
return getNextResults(uriInfo, maxWaitTime);
}
代码示例来源:origin: com.facebook.presto/presto-tests
public static void waitForQueryState(DistributedQueryRunner queryRunner, QueryId queryId, Set<QueryState> expectedQueryStates)
throws InterruptedException
{
QueryManager queryManager = queryRunner.getCoordinator().getQueryManager();
do {
// Heartbeat all the running queries, so they don't die while we're waiting
for (BasicQueryInfo queryInfo : queryManager.getQueries()) {
if (queryInfo.getState() == RUNNING) {
queryManager.recordHeartbeat(queryInfo.getQueryId());
}
}
MILLISECONDS.sleep(500);
}
while (!expectedQueryStates.contains(queryManager.getQueryState(queryId)));
}
代码示例来源:origin: uk.co.nichesolutions.presto/presto-main
queryManager.recordHeartbeat(queryId);
maxWait = queryManager.waitForStateChange(queryId, queryInfo.getState(), maxWait);
queryInfo = queryManager.getQueryInfo(queryId);
代码示例来源:origin: uk.co.nichesolutions.presto/presto-main
queryManager.recordHeartbeat(queryId);
内容来源于网络,如有侵权,请联系作者删除!