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

    https://github.com/apache/drill/pull/858#discussion_r124068854
  
    --- Diff: 
exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/TimeoutTrigger.java ---
    @@ -0,0 +1,105 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.drill.jdbc.impl;
    +
    +import java.util.concurrent.Callable;
    +import java.util.concurrent.ExecutorService;
    +import java.util.concurrent.Executors;
    +import java.util.concurrent.Future;
    +import java.util.concurrent.TimeUnit;
    +
    +import org.apache.calcite.avatica.AvaticaStatement;
    +import org.apache.drill.exec.rpc.NamedThreadFactory;
    +import org.apache.drill.jdbc.SqlTimeoutException;
    +
    +/**
    + * Timeout Trigger required for canceling of running queries
    + */
    +class TimeoutTrigger implements Callable<Boolean> {
    +  //Not using the DrillbitContext's ExecutorService as this is threadPool 
is light-weight (threads wake up to cancel tasks) but needs a low response time
    +  private static ExecutorService timeoutService;
    --- End diff --
    
    The Executor has only sleepign threads. If the Drillbit is shutdown, I'm 
assuming that running queries are cancelled (which implicitly terminates any 
timeout-related threads in this executor), so the Executor will automatically 
be void of any active threads. However, I see your point about having a clean 
way to shut it down. I'll make this as a part of the DrillbitContext, since the 
Executor actually services a running query and, IMO, shouldn't be bound to a 
connection. At the DrillbitContext, I should be able to do a clean shutdown 
without the need for any complex checks. 


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to