[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Handling contexts in error

adrian@jboss.org do-not-reply at jboss.com
Wed Feb 20 09:49:45 EST 2008


"adrian at jboss.org" wrote : There's no notion of holding onto a broken bean
  | (except for error reporting - see above).
  | 

Maybe we could add a notion of errorCallback?
i.e. if a bean errors during the startup process then we would invoke this callback,
something like:


  | public class Container
  | {
  | @Install
  | public void addContained(Contained contained} { // trivial }
  | @Uninstall
  | public void removeContained(Contained contained} { // trivial }
  | @Error
  | public void addError(Contained container) {}
  | @Removed
  | public void removeError(Contained container) {}
  | }
  | 

The @Removed is because the only time it will go out of the error state
is when it is removed altogether from the controller during the redeploy.

But this seems a bit hacky to me? It's looking less like a POJO
and more like what the class says it is a "Container" ;-)

Perhaps a better approach would be for you to register for events
on your "contained" contexts, so you would actually receive:

Pseudo code

  | // Your api
  | removeContained(contained);
  | // Out-of-band notifications from the MC
  | errorOccurred(contained, throwable);
  | uninstalled(contained);
  | // Re-installed
  | addContained(contained);
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4130766#4130766

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4130766



More information about the jboss-dev-forums mailing list