ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [20/50] [abbrv] ignite git commit: Improved exception handling in IgniteContext
Date Wed, 10 Feb 2016 11:56:07 GMT
Improved exception handling in IgniteContext


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d1e2957a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d1e2957a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d1e2957a

Branch: refs/heads/ignite-1786
Commit: d1e2957a7440b7a781439811ab9bdfedf38bd640
Parents: 500bd3a
Author: Valentin Kulichenko <valentin.kulichenko@gmail.com>
Authored: Wed Feb 3 18:44:44 2016 -0800
Committer: Valentin Kulichenko <valentin.kulichenko@gmail.com>
Committed: Wed Feb 3 18:44:44 2016 -0800

----------------------------------------------------------------------
 .../scala/org/apache/ignite/spark/IgniteContext.scala    | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d1e2957a/modules/spark/src/main/scala/org/apache/ignite/spark/IgniteContext.scala
----------------------------------------------------------------------
diff --git a/modules/spark/src/main/scala/org/apache/ignite/spark/IgniteContext.scala b/modules/spark/src/main/scala/org/apache/ignite/spark/IgniteContext.scala
index 6e48017..57fe84f 100644
--- a/modules/spark/src/main/scala/org/apache/ignite/spark/IgniteContext.scala
+++ b/modules/spark/src/main/scala/org/apache/ignite/spark/IgniteContext.scala
@@ -20,7 +20,7 @@ package org.apache.ignite.spark
 
 import org.apache.ignite.internal.IgnitionEx
 import org.apache.ignite.internal.util.IgniteUtils
-import org.apache.ignite.{IgniteSystemProperties, Ignition, Ignite}
+import org.apache.ignite._
 import org.apache.ignite.configuration.{CacheConfiguration, IgniteConfiguration}
 import org.apache.spark.{Logging, SparkContext}
 import org.apache.spark.sql.SQLContext
@@ -146,14 +146,19 @@ class IgniteContext[K, V](
             Ignition.ignite(igniteCfg.getGridName)
         }
         catch {
-            case e: Exception ⇒
+            case e: IgniteIllegalStateException ⇒
                 try {
                     igniteCfg.setClientMode(client || driver)
 
                     Ignition.start(igniteCfg)
                 }
                 catch {
-                    case e: Exception ⇒ Ignition.ignite(igniteCfg.getGridName)
+                    case e: IgniteException ⇒ {
+                        logError("Failed to start Ignite client. Will try to use an existing
instance with name: "
+                            + igniteCfg.getGridName, e)
+
+                        Ignition.ignite(igniteCfg.getGridName)
+                    }
                 }
         }
     }


Mime
View raw message