[jboss-as7-dev] Deployment phase context dependencies and runtime changes to services

Jaikiran Pai jpai at redhat.com
Sat Jan 28 00:04:49 EST 2012


I've got a DUP in Phase.PARSE which attaches a service attachment to the 
DU by adding a dependency on to the next phase context:

phaseContext.addDeploymentDependency(ServiceName.Foo, myAttachmentKey);

Works fine. The attachment which points to a service is available in the 
next phase from the DU. When I deploy a deployment, it passes through 
these phases and deploys fine. Now at runtime I use the CLI to change a 
writeable attribute's value which triggers a 
change/update/reinstallation of the ServiceName.Foo. That's when I start 
seeing problems. Due to the stop/start of the ServiceName.Foo service, 
the already fully deployed deployment is re-deployed starting from 
Phase.MODULE (and skipping the previous phases) because of the 
dependency that was added to the phase context on this service. This 
causes a whole lot of issues (like missing attachments) because the 
deployment has re-started midway through the phases.

The javadoc of DeploymentPhaseContext.addDeploymentDependency says:

/**
  * Adds a dependency on the service to the next phase service. The 
service value will be make available as an attachment to
  * the {@link DeploymentUnit}. This attachment will be removed when the 
phase service for the next phase stops.


So should the dependency on the ServiceName.Foo be retained even after 
the phase service has completed for the deployment unit? Is this a bug 
or the expected behaviour? I wouldn't expect a re-deployment of a 
already deployed unit because of changes to a service which is no longer 
relevant after the deployment unit has been processed.



-Jaikiran


More information about the jboss-as7-dev mailing list