On 18/07/2011 15:52, Brian Stansberry wrote:
On 7/18/11 3:04 AM, David Bosschaert wrote:
> Hi,
>
> I have a piece of code that needs to kick into action when a particular
> EJB is registered. What would be the best way to do this? The code is in
> user-space, it's an OSGi bundle that needs to do something once the EJB
> is available...
>
> So I thought about the following:
> * register a DeploymentUnitProcessor, however this is a bit heavyweight
> to ask a EJB/OSGi developer to do...
> * maybe register an MSC service that waits for an MSC service registered
> by the EJB to appear? this is also a bit heavyweight and I don't think
> the MSC services registered by the EJB are documented/part of the public
> API...
> * It would be nice if I could simply listen for the JNDI registration...
> is that possible?
>
> As a workaround, I also thought about this:
> * If I deploy my artifacts in a certain order, will the appserver deploy
> them again in the same order on a restart?
>
It should invoke the management operations to deploy them in the same
order, yes. However, those management operations install all sorts of
services, and those services' start() methods are called asynchronously
with no guaranteed order and no guarantee that everything for deployment
A is done before deployment B starts. So I doubt a solution based on the
initial order would be robust.
Thanks Brian. I agree that it's not a great idea.
Best regards,
David