本文整理了Java中org.apache.lens.server.api.query.QueryContext.getQueryHandleString
方法的一些代码示例,展示了QueryContext.getQueryHandleString
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QueryContext.getQueryHandleString
方法的具体详情如下:
包路径:org.apache.lens.server.api.query.QueryContext
类名称:QueryContext
方法名:getQueryHandleString
暂无
代码示例来源:origin: org.apache.lens/lens-server-api
/**
* @return query handle string
*/
@Override
public String getLogHandle() {
return getQueryHandleString();
}
代码示例来源:origin: apache/lens
/**
* @return query handle string
*/
@Override
public String getLogHandle() {
return getQueryHandleString();
}
代码示例来源:origin: apache/lens
public String getQueryHandleString() {
return this.lensContext.getQueryHandleString();
}
}
代码示例来源:origin: org.apache.lens/lens-driver-jdbc
public String getQueryHandleString() {
return this.lensContext.getQueryHandleString();
}
}
代码示例来源:origin: apache/lens
public String getQueryHandleString() {
return ctx.getQueryHandleString();
}
代码示例来源:origin: apache/lens
private void addToWaitingQueries(final QueryContext query) throws LensException {
checkEstimatedQueriesState(query);
this.waitingQueries.add(query);
log.info("Added to waiting queries. QueryId:{}", query.getQueryHandleString());
}
}
代码示例来源:origin: apache/lens
/**
* This method is used to add a timed out query to cancellation pool.
* The query gets cancelled asynchronously
* Note : lens.query.cancel.on.timeout should be true for cancellation
*/
private void addQueryToCancellationPool(QueryContext queryCtx, Configuration config, long timeoutMillis) {
if (config.getBoolean(CANCEL_QUERY_ON_TIMEOUT, DEFAULT_CANCEL_QUERY_ON_TIMEOUT)) {
log.info("Query {} could not be completed within the specified timeout interval. It will be cancelled",
queryCtx.getQueryHandleString());
queryCancellationPool.submit(new CancelQueryTask(queryCtx.getQueryHandle()));
} else {
log.info("Query {} could not be completed within the specified timeout interval. Query cancellation is disabled",
queryCtx.getQueryHandleString());
}
}
代码示例来源:origin: apache/lens
private boolean removeFromLaunchedQueries(final QueryContext finishedQuery) {
/* Check javadoc of QueryExecutionServiceImpl#removalFromLaunchedQueriesLock for reason for existence
of this lock. */
log.debug("Acquiring lock in removeFromLaunchedQueries");
removalFromLaunchedQueriesLock.lock();
boolean modified = false;
try {
modified = this.launchedQueries.remove(finishedQuery);
} finally {
removalFromLaunchedQueriesLock.unlock();
}
log.debug("launchedQueries.remove(finishedQuery) has returned [{}] for finished query with query id:[{}]", modified,
finishedQuery.getQueryHandleString());
return modified;
}
代码示例来源:origin: org.apache.lens/lens-server-api
return; //already registered
log.info("Registering driver resultset for query {}", getQueryHandleString());
this.isDriverResultRegistered = true;
} else {
log.info("Skipping creation of PartiallyFetchedInMemoryResultSet as the query {} has already timed out",
getQueryHandleString());
代码示例来源:origin: apache/lens
/**
* Method to insert a new active query into Table.
*
* @param ctx query context
*
* @throws SQLException the exception
*
*/
public void insertActiveQuery(QueryContext ctx) throws LensException {
String sql = "insert into active_queries (queryid, querycontext)"
+ " values (?,?)";
Connection conn = null;
PreparedStatement pstmt = null;
try {
conn = getConnection();
pstmt = conn.prepareStatement(sql);
// set input parameters
pstmt.setString(1, ctx.getQueryHandleString());
pstmt.setObject(2, SerializationUtils.serialize(ctx));
pstmt.execute();
log.info("Inserted query with query " + ctx.getQueryHandleString() + " in database.");
} catch (SQLException e) {
log.error("Failed to insert query " + ctx.getQueryHandleString() + " in database with error, " + e);
throw new LensException(e);
} finally {
DbUtils.closeQuietly(pstmt);
DbUtils.closeQuietly(conn);
}
}
代码示例来源:origin: org.apache.lens/lens-driver-es
@Override
public LensResultSet fetchResultSet(QueryContext context) throws LensException {
try {
/**
* removing the result set as soon as the fetch is done
*/
return resultSetMap.remove(context.getQueryHandle()).get();
} catch (NullPointerException e) {
throw new LensException("The results for the query "
+ context.getQueryHandleString()
+ "has already been fetched");
} catch (InterruptedException | ExecutionException e) {
throw new LensException("Error fetching result set!", e);
}
}
代码示例来源:origin: apache/lens
@Override
public LensResultSet fetchResultSet(QueryContext context) throws LensException {
try {
/**
* removing the result set as soon as the fetch is done
*/
return resultSetMap.remove(context.getQueryHandle()).get();
} catch (NullPointerException e) {
throw new LensException("The results for the query "
+ context.getQueryHandleString()
+ "has already been fetched");
} catch (InterruptedException | ExecutionException e) {
throw new LensException("Error fetching result set!", e);
}
}
代码示例来源:origin: apache/lens
pstmt.setString(1, ctx.getQueryHandleString());
result = pstmt.execute();
log.info("deleted active query " + ctx.getQueryHandleString() + " with final status " + ctx.getStatus()
+ " from database.");
} catch (SQLException e) {
log.error("Failed to delete active query " + ctx.getQueryHandleString()
+ " in database with error, " + e);
throw new LensException(e);
代码示例来源:origin: apache/lens
/**
* Method to update a new active query into Table.
*
* @param ctx query context
*
* @throws LensException the exception
*
*/
public void updateActiveQuery(QueryContext ctx) throws LensException {
String sql = "UPDATE active_queries SET querycontext=? where queryid=?";
Connection conn = null;
PreparedStatement pstmt = null;
try {
conn = getConnection();
pstmt = conn.prepareStatement(sql);
pstmt.setObject(1, SerializationUtils.serialize(ctx));
pstmt.setString(2, ctx.getQueryHandleString());
pstmt.execute();
log.info("Updated query with query " + ctx.getQueryHandleString() + " with query status as "
+ ctx.getStatus().getStatus() + " in database.");
} catch (SQLException e) {
log.error("Failed to update query " + ctx.getQueryHandleString()
+ " in database with error, " + e);
throw new LensException(e);
} finally {
DbUtils.closeQuietly(pstmt);
DbUtils.closeQuietly(conn);
}
}
代码示例来源:origin: apache/lens
@Override
public void process(QueryEnded event) {
logSegregationContext.setLogSegragationAndQueryId(event.getQueryContext().getQueryHandleString());
super.process(event, event.getQueryContext());
}
代码示例来源:origin: apache/lens
/**
* Checks if the events needs a HTTP notification.
*
* @param event
* @param queryContext
* @return
*/
protected boolean isHttpNotificationEnabled(QueryEvent event, QueryContext queryContext) {
if (queryContext == null) {
log.warn("Could not find the context for {} for event:{}. {} HTTP Notification will be generated",
event.getQueryHandle(), event.getCurrentValue(), getNotificationType());
return false;
}
boolean isQueryHTTPNotificationEnabled = queryContext.getConf().getBoolean(
QUERY_HTTP_NOTIFICATION_TYPE_PFX + getNotificationType().name(), false);
if (!isQueryHTTPNotificationEnabled) {
log.info("{} HTTP notification for query {} is not enabled",
getNotificationType(), queryContext.getQueryHandleString());
return false;
}
return true;
}
代码示例来源:origin: apache/lens
private QueryHandle submitQuery(final QueryContext ctx) throws LensException {
synchronized (ctx) {
QueryStatus before = ctx.getStatus();
ctx.setStatus(QueryStatus.getQueuedStatus());
queuedQueries.add(ctx);
log.info("Added to Queued Queries:{}", ctx.getQueryHandleString());
allQueries.put(ctx.getQueryHandle(), ctx);
// Add to session's active query list
getSession(SESSION_MAP.get(ctx.getLensSessionIdentifier())).addToActiveQueries(ctx.getQueryHandle());
fireStatusChangeEvent(ctx, ctx.getStatus(), before);
log.info("Returning handle {}", ctx.getQueryHandle().getHandleId());
return ctx.getQueryHandle();
}
}
代码示例来源:origin: apache/lens
/**
* Default implementation for fetchResultSet for all drivers. Should hold good in most cases.
* Note : If a driver is sticking to this default implementation, it should
* override {@link #createResultSet(QueryContext)}
*/
@Override
public LensResultSet fetchResultSet(QueryContext ctx) throws LensException {
log.info("FetchResultSet: {}", ctx.getQueryHandle());
if (!ctx.getDriverStatus().isSuccessful()) {
throw new LensException("Can't fetch results for a " + ctx.getQueryHandleString() + " because it's status is "
+ ctx.getStatus());
}
ctx.registerDriverResult(createResultSet(ctx)); // registerDriverResult makes sure registration happens ony once
return ctx.getDriverResult();
}
代码示例来源:origin: org.apache.lens/lens-server-api
/**
* Default implementation for fetchResultSet for all drivers. Should hold good in most cases.
* Note : If a driver is sticking to this default implementation, it should
* override {@link #createResultSet(QueryContext)}
*/
@Override
public LensResultSet fetchResultSet(QueryContext ctx) throws LensException {
log.info("FetchResultSet: {}", ctx.getQueryHandle());
if (!ctx.getDriverStatus().isSuccessful()) {
throw new LensException("Can't fetch results for a " + ctx.getQueryHandleString() + " because it's status is "
+ ctx.getStatus());
}
ctx.registerDriverResult(createResultSet(ctx)); // registerDriverResult makes sure registration happens ony once
return ctx.getDriverResult();
}
代码示例来源:origin: apache/lens
private void launchQuery(final QueryContext query) throws LensException {
checkEstimatedQueriesState(query);
query.getSelectedDriver().getQueryHook().preLaunch(query);
QueryStatus oldStatus = query.getStatus();
// If driver supports async updates.
if (query.getSelectedDriver().getStatusUpdateMethod() == StatusUpdateMethod.PUSH) {
query.registerStatusUpdateListener(asyncStatusUpdater);
}
QueryStatus newStatus = new QueryStatus(query.getStatus().getProgress(), null,
QueryStatus.Status.LAUNCHED, "Query is launched on driver", false, null, null, null);
query.validateTransition(newStatus);
// Check if we need to pass session's effective resources to selected driver
addSessionResourcesToDriver(query);
query.getSelectedDriver().executeAsync(query);
query.setStatusSkippingTransitionTest(newStatus);
query.clearTransientStateAfterLaunch();
log.info("Added to launched queries. QueryId:{}", query.getQueryHandleString());
fireStatusChangeEvent(query, newStatus, oldStatus);
}
}
内容来源于网络,如有侵权,请联系作者删除!