powered by Jive Software

Allow clustering to be configured from the conf folder

I have hit a problem trying to configure the clustering plugin: the configuration file must be inside the JAR. What we need to do is add/remove nodes from a centralized console and move the configuration files using rsync. Normally, I’d copy the configuration file under conf and read it from there, but the clustering plugin only looks inside the classpath which doesn’t include conf.

Trying to fix this, I modified PluginManager to add the conf folder to the classpath for all plugins. But then I realized, most plugins can read conf just fine without this modification, so my solution could be a bit of an overkill. The clustering plugin, on the other hand, already uses a custom class loader. So that would be a better spot to add the conf folder to the classpath. But right now, I am using OF 3.7.1 and the clustering plugin that only comes as a JAR - I can make the change for 3.7.2, but it won’t fix the problem for me just yet.

I feel modifying the clustering plugin is the right solution, but I’d like some opinions on that.

I agree this makes sense, and that the Hazelcast plugin is the correct place to make this change (rather than the core PluginManager). While we want to be able to keep the default clustering configuration simple, we also want to provide easy configuration options for more complex implementations.

The Openfire /conf/ directory already exists and is perhaps a convenient default location for this configuration file. However, I would recommend that we also define a new system property to provide a standard way to override this location (e.g. “hazelcast.config.xml.directory” or similar).

For example, it might be preferable to create an ${OPENFIRE_HOME}/classes/ directory for any classpath-based resources, following Java EE classpath conventions. It might also be important in some cases to actually prevent this type of access (via class loader) to the configuration files or other resources in the /conf/ directory.

Thanks for the helpful suggestion!

1 Like

I have made the changes and it seems to load the configuration just fine. I used hazelcast.config.xml.directory to read the folder location and made default to ${OPENFIRE_HOME}/conf/. It’s late already, I think I’ll test it a bit more and commit everything on Monday. Fwiw, I figured out how to make the plugin work w/ OF 3.7.1 as well