Julian Julian - 1 year ago 71
Apache Configuration Question

Apache ignite gives error when you refresh webpage

I'm new to apache ignite.

  1. I have a java web project which gets results that are cached by apache ignite.

  2. I have a separate project that starts and caches results from the database and starts a server node

When I load my web page the first time, all is good and it picks up my results. But if I refresh my page again it gives me an error saying:

Default Ignite instance has already been started.

my code:

public MyConstructor() {
ignite = Ignition.start();

So what happens is when I refresh my page it loads the constructor everytime. Is there a better way to find if a node exists and use that? Or if there is a better way to achieve this.


Answer Source

Use Ignition.getOrStart method. Just pass a new IgniteConfiguration() if you don't need to set anything.