All,
In implementing CDI injection into GenericPortlet and PortletFilter instances, I had
assumed that I could add a ManagedObjectRegistryEventListener, specifically for CDI
processing, and add it to the broadcaster in PortletApplicationDeployer for only those
PortletApplicationDeployment's that needed CDI injection. ie. the listener would be
added before creating a PortletApplicationDeployment and then removed straight afterwards
to ensure that portlet deployments that had nothing to do with CDI, were not calling the
listener for all event notifications for no reason.
An unexpected consequence of this is that I've discovered the broadcaster list of
listeners is the exact same instance across all PortletApplicationDeployment instances. So
when I removed the CDI listener from broadcaster on PortletApplicationDeployer, it also
removed that listener from the PortletApplicationDeployment that had just been created.
Is that expected? I'd find it unusual that its not possible to add a listener specific
to a deployment that should not be applied to all of them.
Wondering if ManagedObjectRegistryEventBroadcaster needs to support cloning to facilitate
this functionality?
Any other thoughts on a better way to do this are appreciated, as I certainly feel it
unnecessary to defensively code my listener for all types of portlets it can be attached
to when it doesn't need to.
Ken
========================
Senior Software Engineer / JBoss Enterprise Middleware Red Hat, Inc.