configURL = uri.toURL();
} else {
throw new URISyntaxException(location, "Unsupported protocol in configuration location URL");
}
try {
Config config = new XmlConfigBuilder(configURL).build();
config.setClassLoader(theClassLoader);
//TODO should we assign an instance name
config.setInstanceName(configURL.toString());
instance = HazelcastInstanceFactory.getOrCreateHazelcastInstance(config);
} catch (Exception e) {
throw ExceptionUtil.rethrow(e);
}
}
String instanceName = properties.getProperty(HazelcastCachingProvider.HAZELCAST_INSTANCE_NAME);
if (instanceName != null) {
instance = Hazelcast.getHazelcastInstanceByName(instanceName);
}
if (isDefault) {
Config config = new XmlConfigBuilder().build();
if (config.getInstanceName() == null) {
config.setInstanceName("JCacheSharedInstance");
}
instance = HazelcastInstanceFactory.getOrCreateHazelcastInstance(config);
}