[ 
https://issues.apache.org/jira/browse/DRILL-3640?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16063455#comment-16063455
 ] 

ASF GitHub Bot commented on DRILL-3640:
---------------------------------------

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. 


> Drill JDBC driver support Statement.setQueryTimeout(int)
> --------------------------------------------------------
>
>                 Key: DRILL-3640
>                 URL: https://issues.apache.org/jira/browse/DRILL-3640
>             Project: Apache Drill
>          Issue Type: New Feature
>          Components: Client - JDBC
>    Affects Versions: 1.2.0
>            Reporter: Chun Chang
>            Assignee: Kunal Khatua
>             Fix For: 1.11.0
>
>
> It would be nice if we have this implemented. Run away queries can be 
> automatically canceled by setting the timeout. 
> java.sql.SQLFeatureNotSupportedException: Setting network timeout is not 
> supported.
>       at 
> org.apache.drill.jdbc.impl.DrillStatementImpl.setQueryTimeout(DrillStatementImpl.java:152)



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to