A plugin is always reinstantiated when rendering, so there will be
multiple copies around.
InitializablePlugin.initialize() is executed once during startup.
However, it is a trivial matter to install a singleton in your JVM,
then have the plugin redirect to it, e.g.
public String execute(WIkiEngine e, Map params)
{
MySingletonPlugin p = MySingletonPlugin.getInstance();
return p.execute(e,params);
}
/Janne
On 24 Jul 2009, at 18:36, Dalen, Andre van wrote:
Hello,
I am writing a plugin for JSPWiki that manages data which is persisted
in the filesystem.
The collection of data is loaded on initialize() and stored on
receiving
a shutdown event.
The Javadoc of PluginManager explains about events during the
lifecycle
of a plugin,
but does not specify the multiplicity of plugins: is any plugin loaded
only once in JSPWiki -
i.e. is a plugin instance in fact a logical singleton?
If plugins are loaded only once, I can keep the data collection as
attribute to the plugin
instance (using synchronisation to shield concurrent calls) but if
multiple plugin instances
can be created I will have to keep the data collection as static
fields.
Can anyone enlighten me?
regards, Andre van Dalen