Plugin loading order or Plugin Dependencies on other Plugins?

Hi!

I’ve got two plugins and I need to control the order in which they are initialized. I have the Hazelcast plugin (Plugin A) and another Plugin (Plugin B) which requires that Hazelcast is up and running, in order to use the Hazelcast shared map data structure.

Is there a way to specify the plugin loading order or create a dependency such that Plugin A loads first, and once it completes intializing, then Plugin B initializes?

Thanks!

org.jivesoftware.openfire.clusterClusterManager.addListener(ClusterEventListener listener) will add a callback; the joinedCluster() event will tell you when you’ve joined the cluster and you’ve got the Hazelcast shared map data structure.

A word of warning; it sounds obvious, but if clustering is not enabled, joinedCluster() will never be called.

Greg

What seems to work well, at this point, is for plugin B to start a thread and return from initialization. In that thread, it polls until the cluster manager (plugin A) isClusteringStarted method indicates clustering is up and running. Then plugin B can start its main logic.

You can declare the hazelcast plugin to be the parent of your own plugin, by declaring a parentPlugin element in the plugin.xml file of your plugin (refer to the Plugin Developer Guide for more information). Note that this will cause them to share a classloader, which might be an undesirable side-effect.