From dev-return-42763-apmail-ignite-dev-archive=ignite.apache.org@ignite.apache.org Sun Dec 2 15:39:36 2018 Return-Path: X-Original-To: apmail-ignite-dev-archive@minotaur.apache.org Delivered-To: apmail-ignite-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B21CC18467 for ; Sun, 2 Dec 2018 15:39:36 +0000 (UTC) Received: (qmail 57945 invoked by uid 500); 2 Dec 2018 15:39:36 -0000 Delivered-To: apmail-ignite-dev-archive@ignite.apache.org Received: (qmail 57899 invoked by uid 500); 2 Dec 2018 15:39:36 -0000 Mailing-List: contact dev-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list dev@ignite.apache.org Received: (qmail 57887 invoked by uid 99); 2 Dec 2018 15:39:35 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Dec 2018 15:39:35 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 58592D2AF0 for ; Sun, 2 Dec 2018 15:39:35 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.152 X-Spam-Level: X-Spam-Status: No, score=0.152 tagged_above=-999 required=6.31 tests=[DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FROM_EXCESS_BASE64=0.105, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id sM3Qes2pqNuH for ; Sun, 2 Dec 2018 15:39:34 +0000 (UTC) Received: from mail-oi1-f193.google.com (mail-oi1-f193.google.com [209.85.167.193]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id BD65F5F4E7 for ; Sun, 2 Dec 2018 15:39:33 +0000 (UTC) Received: by mail-oi1-f193.google.com with SMTP id x202so8745048oif.13 for ; Sun, 02 Dec 2018 07:39:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-transfer-encoding; bh=4Pl/hi811S1N+ggJ2tBz9WrnXcJ99Cb0iE2CFVcsfMg=; b=mlbFIhM2y1rRScTqkgMgqcHnNw9w+HD03k4pmwJ0yrvBPskM4IfxvtdartQVk9sM2U RzEBsgFkF1nbr2P0RlW2IU79j2QVklGFj3PGQKUhRKn6ERtR4sKWO/ZaLGTZTRimxiF9 TRF4QXqjhMuJ5XMEEiYphj+6KC9Ckd4Yru/9Y9wu0d5rjSHBoP/xVkNrmOA2Oq81VRSp jeNOUww5V3lzNmiASaEOJExX7fAqgBF6eooJqGHuIOpVjEkK3wdnk/WcY0sGTqA00M2x PWInrBZnVRoQMuE3WepIhdL4l8vQI1Nlk8T7UdPfAdy431HqsXX/qaeOjp+CcOUbvo6a ITBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-transfer-encoding; bh=4Pl/hi811S1N+ggJ2tBz9WrnXcJ99Cb0iE2CFVcsfMg=; b=P3jJQRRqdGuLvOKSEifAdfgjyiyPBD4+4MBW2s78PScDivRdXqf9IPtvCi7U6r2pWC JRRCopklRgWoSOZywMgLI12D6G0SG3wx5Tak9PZpiAunwdN455hPs3GsqmuOvnR+6Uz1 zBaHinmBdyJRrpT4E3uTTKiw6Bf9outcZD4iWQslJ85qJaOQ13YsgWg2lGlqrnzMZ3rG boxbplu8asKQ5uWfTzzmyH9DJDY3ECQcE6c9V1TiCzd35mBcsxprfEtFQIwSpv6cJ0zU ghPDqbEVQCm1s6bZMkhspuJbL1DzsZHGnkoIp8RDJTJJlUL83WVwUofNFA+QUVg+NECI 6APA== X-Gm-Message-State: AA+aEWYYy5UN/XitVhu5t8fYJakDT9lNcAerc0tJXKTlq9JQuoAXSOpE bWznMKxwsetX7WDGov72QqDpMNhxwh2E9LoXW1hskw== X-Google-Smtp-Source: AFSGD/XUT3Mln5OCZTmx/O1osCDsJBDJ/u9PB2Kdb1pj03acLggAIOenAyRS7bP7ELH+eYzMHE/qVw28zCucqPPVzmQ= X-Received: by 2002:aca:cd87:: with SMTP id d129mr8120405oig.120.1543765173001; Sun, 02 Dec 2018 07:39:33 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a9d:7a97:0:0:0:0:0 with HTTP; Sun, 2 Dec 2018 07:39:32 -0800 (PST) In-Reply-To: References: From: =?UTF-8?B?0J/QsNCy0LvRg9GF0LjQvSDQmNCy0LDQvQ==?= Date: Sun, 2 Dec 2018 18:39:32 +0300 Message-ID: Subject: Re: JDBC thin driver: support connection timeout To: dev@ignite.apache.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Missing ref: [2] https://mvnrepository.com/artifact/org.mariadb.jdbc/mariadb-java-client= /2.3.0 2018-12-02 18:31 GMT+03:00, =D0=9F=D0=B0=D0=B2=D0=BB=D1=83=D1=85=D0=B8=D0= =BD =D0=98=D0=B2=D0=B0=D0=BD : > Hi Alexander, > > I have 2 points. > > 1. According to the jdbc spec [1] setNetworkTimeout method is > optional. What user problem we are going to solve by implementing that > method? > 2. Also I checked another quite popular jdbc driver provided by > MariaDB [2]. They ignore an executor argument as well and set a socket > timeout instead. So, I think that we are on a safe side if we ignore > an executor. > > [1] https://download.oracle.com/otndocs/jcp/jdbc-4_2-mrel2-spec/index.htm= l > =D0=BF=D1=82, 30 =D0=BD=D0=BE=D1=8F=D0=B1. 2018 =D0=B3. =D0=B2 16:28, Ale= xander Lapin : >> >> Hi Igniters, >> >> Within context of connection timeout [ >> https://issues.apache.org/jira/browse/IGNITE-5234] it's not obvious >> whether >> it's required to use setNetworkTimeout's executor or not. >> >> According to the javadoc of >> java.sql.Connection#setNetworkTimeout(Executor >> executor, int milliseconds), executor is "The Executor >> implementation which will be used by setNetworkTimeout." >> Seems that executor supposed to take care of connection closing/aborting >> in >> case of timeout, based on submitted Runnable implementation. On the othe= r >> hand it's possible to ignore executor and implement >> timeout-detection/cancellation logic with Timer. Something like followin= g >> (pseudo-code): >> >> ConnectionTimeoutTimerTask connectionTimeoutTimerTask =3D new >> ConnectionTimeoutTimerTask(timeout); >> timer.schedule(connectionTimeoutTimerTask, 0, REQUEST_TIMEOUT_PERIOD); >> ... >> JdbcResponse res =3D cliIo.sendRequest(req); >> ... >> >> private class ConnectionTimeoutTimerTask extends TimerTask { >> ... >> @Override public void run() { >> if (remainingConnectionTimeout <=3D 0) >> close(); //connection.close(); >> >> remainingConnectionTimeout -=3D REQUEST_TIMEOUT_PERIOD; >> } >> ... >> } >> >> It worth to mention that MSSQL Jdbc driver doesn't use executor and >> PostgreSQL doesn't implement setNetworkTimeout() at all. >> >> From my point of view it might be better to ignore executor, is it >> suitable? >> >> Any ideas? > > > > -- > Best regards, > Ivan Pavlukhin > --=20 Best regards, Ivan Pavlukhin