New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getOrCreate default HazelCast instance #10007

Closed
snicoll opened this Issue Mar 2, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@snicoll
Contributor

snicoll commented Mar 2, 2017

Is there a reason why Hazelcast doesn't have a getOrCreateHazelcastInstance() that detects a default configuration file?

If you have a Config at hand that you read from hazelcast.xml at the root of the classpath then you can either create the instance or get an existing one (using getOrCreateHazelcastInstance(Config config)). However, if you don't, then Hazelcast will always create another instance, even if the configuration URI matches.

Am I missing something? This relates to spring-projects/spring-boot#8467

snicoll added a commit to snicoll/hazelcast-code-samples that referenced this issue Mar 2, 2017

Fix sample
This commit tries to clarify the sample with regards to some discussion
on the Spring Boot issue tracker, in particular:

spring-projects/spring-boot#8275

To be able to reuse an `HazelcastInstance` in server mode, the location
of the configuration file should be set in both auto-configuration
unfortunately: there is currently now way to reuse an instance that was
loaded via the default configuration. See the following issue:

hazelcast/hazelcast#10007

In a client scenario, the only way is to effectively disable the
auto-configuration which annoys me a lot. Probably Spring Boot should
back off automatically in such a scenario but we need a way to reliably
figure this out.

Also, I wasn't aware that Hazelcast provides different `CachingProvider`
that are looking for different things. IMO, there is a gap in the
caching support in Spring Boot about it and I'd be more than happy to
improve it as long as I don't need to resort to Hazelcast specific API
inside the JCache auto-configuration

@vbekiaris vbekiaris added this to the 3.9 milestone Mar 10, 2017

@vbekiaris vbekiaris closed this in #10059 Mar 16, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment