-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recommend OSGi EventHandler for APP_STARTUP_COMPLETE over IStartup #1362
Recommend OSGi EventHandler for APP_STARTUP_COMPLETE over IStartup #1362
Conversation
public class MonitoringStartup implements IStartup { | ||
@Component(service = EventHandler.class) | ||
@EventTopics(value = UIEvents.UILifeCycle.APP_STARTUP_COMPLETE) | ||
public class MonitoringStartup implements EventHandler { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can even define a new composite annotation like this
@Component(service = EventHandler.class)
@EventTopics(value = UIEvents.UILifeCycle.APP_STARTUP_COMPLETE)
public @interface StartupComponent {
}
what the can be used like this
public class MonitoringStartup implements EventHandler { | |
@StartupComponent | |
public class MonitoringStartup implements EventHandler { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I try to add for example to the UILifeCycle
class:
@Component(service = EventHandler.class)
@EventTopics(value = APP_STARTUP_COMPLETE)
public static @interface StartupCompleted {
}
I get the error Invalid component implementation class 'StartupCompleted': annotation type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe @Component
can't be placed on meta annotation, maybe its just a bug in PDE-DS ...
bundles/org.eclipse.ui.monitoring/src/org/eclipse/ui/internal/monitoring/MonitoringStartup.java
Outdated
Show resolved
Hide resolved
45d34c2
to
c411f2b
Compare
An This gives users a choice to enable or disable certain startups. I suppose the OSGI mechanism does not respect the preference page? In that case I don't think |
I'm in favor of deprecating IStartup and marking it for deletion. The user option to disable IStartup was always very dangerous in my opinion as this would allow the user to disable potential critical infrastructure. |
I'm not sure, I consider the preference a feature, e.g. we have a 'Release notes' feature for our product that is triggered via an With the two alternatives we now have to chance to separate mandatory/critical startups from optional ones and convert those to OSGI event handlers. My vote would be to state the fact in the Javadoc of |
I think that would be much more suitable to have a custom preference (page) for that that having to go into some generic dialogs. |
+1 |
But that's we is out there today. I assume other RCP products may also use this feature. If platform now changes how this behaves: this is incompatible and will force RCP implementers to adapt their code. And what's the value of it? Besides that: I as a user find it quite nice to have one central place where I can turn off / on such start ups. |
FWIW - I have never seen (nor recommended) using IStartup in RCP applications. The ability to disable them, make it impossible to rely on the functionality for the regular use case that "something should start early". |
c411f2b
to
7259862
Compare
@HannesWell can we apply this? The recommendation is fine for now IMHO. Once we have removed the usage of IStartup from p2 we can discuss to deprecate it, even though maybe not mark it for deletion yet due to the concerns from @BeckerWdf and @sratz. But it might be good to guide new users to use the new approach). Please also add to N&N so that people can find it. |
alternative And migrate MonitoringStartup accordingly.
7259862
to
e9b5ee4
Compare
Thank you @sratz for mentioning this, I didn't knew it. And yes, at least to my knowledge, one cannot disable the execution of OSGi event handlers. And like Lars I would consider this, at least in general, a dangerous feature if it is used for critical tasks. And since it was not mention in the doc, I'm not sure if everyone that uses it is aware of it (I wasn't).
To some extend I understand that demand. But not everything that runs at start-up currently implements IStartup. Many things happens in Activators or code triggered by activators. So you will only see a sub-set of everything any ways.
Applying this to the Freeze-Monitor currently requires the latest Features in the PDE DS support which was just implemented by @laeubi in eclipse-pde/eclipse.pde#923. It is currently only available only available in I-builds. |
Lets reduce our usage of IStartup, the deprecation may come later, we may want to "only" deprecate for now and not mark for deletion so that new usages of this "feature" are avoided. |
As per https://www.w3.org/TR/html401/struct/text.html#edef-P p tag can not contain other nested block-level elements (like pre used here). Error is visible at https://download.eclipse.org/eclipse/downloads/drops4/I20231213-1800/compilelogs/platform.doc.isv.javadoc.txt and has been broken by change in eclipse-platform#1362
As per https://www.w3.org/TR/html401/struct/text.html#edef-P p tag can not contain other nested block-level elements (like pre used here). Error is visible at https://download.eclipse.org/eclipse/downloads/drops4/I20231213-1800/compilelogs/platform.doc.isv.javadoc.txt and has been broken by change in #1362
As per https://www.w3.org/TR/html401/struct/text.html#edef-P p tag can not contain other nested block-level elements (like pre used here). Error is visible at https://download.eclipse.org/eclipse/downloads/drops4/I20231213-1800/compilelogs/platform.doc.isv.javadoc.txt and has been broken by change in eclipse-platform#1362
And migrate
MonitoringStartup
accordingly.This also uses the
org.osgi.service.event.propertytypes.EventTopics
ComponentPropertyType
for which PDE has very recently got support for via eclipse-pde/eclipse.pde#923.Instead of just recommending the OSGi EventHandler over IStartup, we could also deprecate
IStartup
and the associcate extension-point in favor of this approach? I can then migrate the only remaining usage in the SDK in P2.