What is the problem you are trying to solve?
We have a customized handler for DLUserNotificationHandler, but even though our handler registers first and has a higher service ranking than Liferay’s default handler, Liferay’s handler is still selected instead of the custom one.
After reviewing the source implement in LPSA-71834 (UserNotificationManagerUtil), we found that _userNotificationHandlers is stored in a regular HashMap, not a ServiceTrackerMap. As a result, service ranking is ignored, and whichever handler is registered last is the one selected.
What is your project about?
Supplier Portal
What is your proposed solution? (optional)
We propose using a service-tracking mechanism that respects OSGi service rankings (e.g., ServiceTrackerMapFactory) instead of manually managing handlers in a plain HashMap.
This would ensure the handler with the highest service ranking is selected.