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

    https://github.com/apache/drill/pull/921#discussion_r150047464
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java ---
    @@ -348,6 +354,21 @@ public void run() {
          */
       }
     
    +  /*
    +    Check if the foreman is ONLINE. If not dont accept any new queries.
    +   */
    +  public void checkForemanState() throws ForemanException{
    +    DrillbitEndpoint foreman = drillbitContext.getEndpoint();
    +    Collection<DrillbitEndpoint> dbs = drillbitContext.getAvailableBits();
    --- End diff --
    
    I was thinking of encapsulating code from lines 360 to 367 into a boolean 
isOnline(), since all the values in that code are derived from the current 
DrillbitContext.  Then your code would be simplified to 
    `
    public void checkForemanState() throws ForemanException{
      if (!drillbitContext.isOnline()) {
          throw new ForemanException("Query submission failed since Foreman is 
shutting down.");
      }
    }
    `


---

Reply via email to