Loading/unloading & disabling/enabling a plugin at runtime

723 views
Skip to first unread message

James Moger

unread,
Mar 30, 2014, 10:18:52 AM3/30/14
to pf...@googlegroups.com
I see that plugins are always unzipped on startup which is useful for development since we don't have to cleanup the exploded plugin folder.

Would it be possible to load/unload plugins dynamically at runtime too?  Or is a server/app restart the recommended approach?

Along the same lines, pf4j supports enabling/disabling plugins.  Should that capability be exposed through the plugin manager?

-J

Decebal Suiu

unread,
Mar 30, 2014, 5:21:17 PM3/30/14
to pf...@googlegroups.com

On Sunday, March 30, 2014 5:18:52 PM UTC+3, James Moger wrote:
I see that plugins are always unzipped on startup which is useful for development since we don't have to cleanup the exploded plugin folder.
In my projects I prefer the structure with core and plugins folders (maven modules) and in plugins folder I have a sub folder (module) for each plugin. On this structure I have a great boost for development because I simple write code and (re)run application. For more information see https://github.com/decebals/pf4j#development-mode.
 

Would it be possible to load/unload plugins dynamically at runtime too?  Or is a server/app restart the recommended approach?
I will investigate this aspect. I have some code for auto detect modifications in plugins folder (using a file watcher from jdk 7). You can throw a new zip in that folder and the plugin manager can load and start a new plugin. The same for remove and update. My intention was to add hot swap (without application restart) for pf4j but I see some possible memory leaks (on plugin update). Maybe the best approach is to notify the application about plugins structure modifications and to supply some method in plugin manager for load, unload, ...
Can you give me more details about your needs? 
 

Along the same lines, pf4j supports enabling/disabling plugins.  Should that capability be exposed through the plugin manager?
Yes, I can see this possibility (maybe the simple implementation is to write in enabled.txt and disabled.txt form plugin manager when enablePlugin/disablePlugin is called)
 

-J

James Moger

unread,
Mar 31, 2014, 9:16:17 AM3/31/14
to pf...@googlegroups.com
> Maybe the best approach is to notify the application
> about plugins structure modifications and to supply some method in plugin
> manager for load, unload, ...
> Can you give me more details about your needs?

I'd be happy with manual load/unload controls and enable/disable controls.

Gitblit[1] is a pure-java Git server. The next major release will
feature an integrated SSH daemon and a plugin/extension mechanism
based on pf4j. I have an incomplete SSH command to remotely
administer/control plugins which I'd like to be more functional - but
this will depend on either improving pf4j or implementing some things
outside pf4j. My preference is to have a few more management APIs
within pf4j - that makes it more useful for everyone.

> Yes, I can see this possibility (maybe the simple implementation is to write
> in enabled.txt and disabled.txt form plugin manager when
> enablePlugin/disablePlugin is called)

That should be fine. How do you reconcile "enabled.txt" and
"disabled.txt"? For example, if I explicitly enable a plugin in
enabled.txt does that automatically disable all other plugins?

-J

[1]: http://gitblit.com
Reply all
Reply to author
Forward
0 new messages