Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A9BA418059 for ; Sat, 4 Jul 2015 13:08:04 +0000 (UTC) Received: (qmail 90408 invoked by uid 500); 4 Jul 2015 13:08:04 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 90374 invoked by uid 500); 4 Jul 2015 13:08:04 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 90364 invoked by uid 99); 4 Jul 2015 13:08:04 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Jul 2015 13:08:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 02A791A66F6 for ; Sat, 4 Jul 2015 13:07:59 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.771 X-Spam-Level: * X-Spam-Status: No, score=1.771 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id RyS44m9WrFR8 for ; Sat, 4 Jul 2015 13:07:58 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with SMTP id 6E599275EF for ; Sat, 4 Jul 2015 13:07:49 +0000 (UTC) Received: (qmail 89608 invoked by uid 99); 4 Jul 2015 13:07:49 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Jul 2015 13:07:49 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id AD604E360A; Sat, 4 Jul 2015 13:07:48 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sevdokimov@apache.org To: commits@ignite.incubator.apache.org Date: Sat, 04 Jul 2015 13:07:55 -0000 Message-Id: In-Reply-To: <186a684858d247c6b7104f5b3031ff20@git.apache.org> References: <186a684858d247c6b7104f5b3031ff20@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [08/50] incubator-ignite git commit: # ignite-gg-1064 use loopback address in clock server if failed to get local host # ignite-gg-1064 use loopback address in clock server if failed to get local host Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/0ef74a14 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/0ef74a14 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/0ef74a14 Branch: refs/heads/ignite-591 Commit: 0ef74a1449d503ae65a200e48da735b545e923da Parents: b5bc06e Author: sboikov Authored: Tue Jun 30 15:07:18 2015 +0300 Committer: sboikov Committed: Tue Jun 30 15:07:18 2015 +0300 ---------------------------------------------------------------------- .../processors/clock/GridClockServer.java | 21 +++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0ef74a14/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java index e47d1fa..a835da8 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java @@ -62,9 +62,20 @@ public class GridClockServer { int startPort = ctx.config().getTimeServerPortBase(); int endPort = startPort + ctx.config().getTimeServerPortRange() - 1; - InetAddress locHost = !F.isEmpty(ctx.config().getLocalHost()) ? - InetAddress.getByName(ctx.config().getLocalHost()) : - U.getLocalHost(); + InetAddress locHost; + + if (F.isEmpty(ctx.config().getLocalHost())) { + try { + locHost = U.getLocalHost(); + } + catch (IOException e) { + locHost = InetAddress.getLoopbackAddress(); + + U.warn(log, "Failed to get local host address, will use loopback address: " + locHost); + } + } + else + locHost = InetAddress.getByName(ctx.config().getLocalHost()); for (int p = startPort; p <= endPort; p++) { try { @@ -83,8 +94,8 @@ public class GridClockServer { } if (sock == null) - throw new IgniteCheckedException("Failed to bind time server socket within specified port range [locHost=" + - locHost + ", startPort=" + startPort + ", endPort=" + endPort + ']'); + throw new IgniteCheckedException("Failed to bind time server socket within specified port range " + + "[locHost=" + locHost + ", startPort=" + startPort + ", endPort=" + endPort + ']'); } catch (IOException e) { throw new IgniteCheckedException("Failed to start time server (failed to get local host address)", e);