[jboss-dev-forums] [JBoss AS7 Development] - Re: Asynchronous results from executing a deployment plan

David Lloyd do-not-reply at jboss.com
Thu Sep 9 09:18:38 EDT 2010


David Lloyd [http://community.jboss.org/people/david.lloyd%40jboss.com] created the discussion

"Re: Asynchronous results from executing a deployment plan"

To view the discussion, visit: http://community.jboss.org/message/560743#560743

--------------------------------------------------------------
I don't like the await() methods.  Talking from MSC experience, using a caller-blocking methodology doesn't mix well with the callback-driven methodology used by MSC.  In particular, if you use an await()-like method from within an MSC task (listener, service start/stop, etc) which depends on a change in another service (and believe me, people will do this), you may be introducing a deadlock since that service's completion may ultimately depend upon you.

That said - looks like you have no provision for supporting on-demand services.  This is actually a tricky problem because a service's mode can change irrespective of the current controller state (i.e. the fact that a listener is running doesn't "preserve" the current controller mode).  Thus a service's mode can change on you, so you can't just say "if this service is automatic/immediate, add it to the set of incomplete dependents" because changing the mode to on-demand can "complete" it.  Also, an AUTOMATIC service which doesn't start because of an ON_DEMAND dependency could also be considered "complete" for the purposes of deployment.  However not all AUTOMATIC services can be considered complete.

So the question is, what does it mean for a deployment to be "done"?  Saying that all services in the deployment have fully started won't work due to on-demand and other services which are not expected to start immediately, and possibly changing modes etc.  So you really need to track a specific subset of services which represent the meat of the deployment, which can vary based on deployment type and probably other factors as well.  For some deployments, it may not even be possible to wait for +any+ services to start.  This means that the listener would be applied to a select set of services only.

As for the race condition, that's not too hard to solve since you're using locks & conditions: just add a flag "started" which you set to "true" (with a signalAll() [btw, you should use signal*, not notify* with Condition]) which is evaluated as part of the condition for readiness.  The flag would be set once the batch is installed (then you'd know all the listeners were added).
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/560743#560743]

Start a new discussion in JBoss AS7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20100909/658aad64/attachment.html 


More information about the jboss-dev-forums mailing list