Github user navis commented on a diff in the pull request:

    https://github.com/apache/tajo/pull/432#discussion_r28479952
  
    --- Diff: tajo-core/src/main/java/org/apache/tajo/master/QueryInfo.java ---
    @@ -119,14 +119,37 @@ public int getQueryMasterClientPort() {
         return queryMasterClientPort;
       }
     
    -  public TajoProtos.QueryState getQueryState() {
    +  public synchronized TajoProtos.QueryState getQueryState() {
         return queryState;
       }
     
    -  public void setQueryState(TajoProtos.QueryState queryState) {
    +  public synchronized boolean isTerminalState() {
    +    return isTerminalState(queryState);
    +  }
    +
    +  public static boolean isTerminalState(TajoProtos.QueryState state) {
    +    return state == TajoProtos.QueryState.QUERY_FAILED ||
    +        state == TajoProtos.QueryState.QUERY_ERROR ||
    +        state == TajoProtos.QueryState.QUERY_KILLED ||
    +        state == TajoProtos.QueryState.QUERY_SUCCEEDED;
    +  }
    +
    +  public synchronized void setQueryState(TajoProtos.QueryState queryState) 
{
         this.queryState = queryState;
    +    notifyAll();
       }
     
    +  public synchronized boolean waitState(TajoProtos.QueryState expect, long 
timeout)
    +      throws InterruptedException {
    +    long prev = System.currentTimeMillis();
    +    while (timeout > 0 && expect != queryState && !isTerminalState()) {
    +      wait(timeout);
    --- End diff --
    
    wait(timeout) waits on lock for timeout msec. Isn't it?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to