Describe the bug
Not sure how to explain this one. I'm working on a plugin for OIE and I was struggling with some errors appearing on the mirth.log file on server shutdown.
If you look at the initPlugins function, you can see that each plugin will be put in a specific map according to their plugin type (here, here, here, etc.), but they are also added to an ArrayList of server plugins.
Now if you look at the stopPlugins function that is called when the server shuts down, you'll see that the stop function is called for each plugin in the array list, thus, multiple times if you have a class that implements multiple ServerPlugin.
To Reproduce
Create a plugin that implements multiple "ServerPlugin" interface. Let's say I have a class that implements the ServicePlugin interface that also implements the ChannelPlugin (cuz the service needs to intercept channel creation, save, deletion, etc.). Then the "stop()" function will be called twice.
Expected behavior
The "stop" function should be called only once.
Actual behavior
The "stop" function is called according to the number of "ServerPlugin" interfaces the class implements.
Workaround(s)
Create a dedicated class for each type of ServerPlugin you want to implement. Then if you have something to do that can only be done once, do it in the proper class implementation.
Additional context
I would be happy to work on this one if the community thinks it would nice to solve this.
Describe the bug
Not sure how to explain this one. I'm working on a plugin for OIE and I was struggling with some errors appearing on the mirth.log file on server shutdown.
If you look at the initPlugins function, you can see that each plugin will be put in a specific map according to their plugin type (here, here, here, etc.), but they are also added to an ArrayList of server plugins.
Now if you look at the stopPlugins function that is called when the server shuts down, you'll see that the
stopfunction is called for each plugin in the array list, thus, multiple times if you have a class that implements multiple ServerPlugin.To Reproduce
Create a plugin that implements multiple "ServerPlugin" interface. Let's say I have a class that implements the ServicePlugin interface that also implements the ChannelPlugin (cuz the service needs to intercept channel creation, save, deletion, etc.). Then the "stop()" function will be called twice.
Expected behavior
The "stop" function should be called only once.
Actual behavior
The "stop" function is called according to the number of "ServerPlugin" interfaces the class implements.
Workaround(s)
Create a dedicated class for each type of ServerPlugin you want to implement. Then if you have something to do that can only be done once, do it in the proper class implementation.
Additional context
I would be happy to work on this one if the community thinks it would nice to solve this.