Unify HazelcastInstance creation.

Change-Id: Ia54523b57a33329cbf883a98e912ccc1b50c02b1
diff --git a/src/main/java/net/onrc/onos/core/datagrid/HazelcastCLI.java b/src/main/java/net/onrc/onos/core/datagrid/HazelcastCLI.java
index 1ed4d75..6948ee1 100644
--- a/src/main/java/net/onrc/onos/core/datagrid/HazelcastCLI.java
+++ b/src/main/java/net/onrc/onos/core/datagrid/HazelcastCLI.java
@@ -38,7 +38,7 @@
             config.addExecutorConfig(new ExecutorConfig("e" + k).setPoolSize(k));
         }
 
-        HazelcastCLI cli = new HazelcastCLI(Hazelcast.newHazelcastInstance(config));
+        HazelcastCLI cli = new HazelcastCLI(Hazelcast.getOrCreateHazelcastInstance(config));
         cli.start(args);
     }
 
diff --git a/src/main/java/net/onrc/onos/core/datagrid/HazelcastDatagrid.java b/src/main/java/net/onrc/onos/core/datagrid/HazelcastDatagrid.java
index 1d0d8ea..4a59cbf 100644
--- a/src/main/java/net/onrc/onos/core/datagrid/HazelcastDatagrid.java
+++ b/src/main/java/net/onrc/onos/core/datagrid/HazelcastDatagrid.java
@@ -182,7 +182,7 @@
      */
     @Override
     public void startUp(FloodlightModuleContext context) {
-        hazelcastInstance = Hazelcast.newHazelcastInstance(hazelcastConfig);
+        hazelcastInstance = Hazelcast.getOrCreateHazelcastInstance(hazelcastConfig);
 
         restApi.addRestletRoutable(new DatagridWebRoutable());
     }
diff --git a/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZClient.java b/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZClient.java
index ee7d862..eaa647c 100644
--- a/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZClient.java
+++ b/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZClient.java
@@ -74,8 +74,9 @@
      * Get or create the Hazelcast Instance to use for datastore.
      */
     private HZClient() {
+        Config config = HazelcastDatagrid.loadHazelcastConfig(BASE_CONFIG_FILENAME);
         // Try to get the existing HZ instance in JVM if possible.
-        HazelcastInstance instance = Hazelcast.getHazelcastInstanceByName(HazelcastDatagrid.ONOS_HAZELCAST_INSTANCE);
+        HazelcastInstance instance = Hazelcast.getOrCreateHazelcastInstance(config);
         if (instance == null) {
             log.error("Failed to get the Hazelcast instance in JVM. "
                     + "Probably DataStoreClient was requested before "