Puneet Gupta created LENS-1282:
----------------------------------
Summary: getUpdatedQueryContext() call is missing from
QueryExecutionServiceImpl#executeTimeoutInternal
Key: LENS-1282
URL: https://issues.apache.org/jira/browse/LENS-1282
Project: Apache Lens
Issue Type: Bug
Reporter: Puneet Gupta
Assignee: Puneet Gupta
We should call getUpdatedQueryContext() in while loop to make sure latest
status is available after each "listener.wait(waitMillisPerCheck)"
{code}
if (totalWaitTime > 0 && !queryCtx.getStatus().executed() &&
!queryCtx.getStatus().finished()) {
log.info("Registering for query {} completion notification",
ctx.getQueryHandleString());
queryCtx.getSelectedDriver().registerForCompletionNotification(handle,
totalWaitTime, listener);
try {
// We will wait for a few millis at a time until we reach max required
wait time and also check the state
// each time we come out of the wait.
// This is done because the registerForCompletionNotification and query
execution completion can happen
// parallely especailly in case of drivers like JDBC and in that case
completion notification may not be
// received by this listener. So its better to break the wait into
smaller ones.
long waitMillisPerCheck = totalWaitTime/10;
waitMillisPerCheck = (waitMillisPerCheck > 500) ? 500 :
waitMillisPerCheck; // Lets keep max as 500
long totalWaitMillisSoFar = 0;
synchronized (listener) {
while (totalWaitMillisSoFar < totalWaitTime
&& !queryCtx.getStatus().executed() &&
!queryCtx.getStatus().finished()) {
listener.wait(waitMillisPerCheck);
totalWaitMillisSoFar += waitMillisPerCheck;
}
}
} catch (InterruptedException e) {
log.info("{} query completion notification wait interrupted",
queryCtx.getQueryHandleString());
}
}
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)