[jboss-dev-forums] [Design of POJO Server] - Re: Sub-Profiles ProfileService changes

bstansberry@jboss.com do-not-reply at jboss.com
Tue Jan 27 13:52:01 EST 2009


Re: resurrecting DeploymentPhase, that wouldn't help with my example case of a war in deploy-hasingleton/. The missing dependency in the example is deploy/jbossweb.sar (the web server) *not* deployers/jbossweb.deployer.  (One of the things the war deployers do is establish a dependency on the web server.) So, the MC knows to wait to install the war beans until the webserver is available. But validating the "deploy-hasingleton" profile won't give the MC a chance to be patient.

anonymous wrote : I did not really get what you meant with skipping the validation on a re-entrant activateProfile :-/

The reentrant call path looks like this:

ProfileServiceBootstrap.start(Server) --> ProfileService.activateProfile("all") --> HASingletonDeployer bean starts, becomes master --> HASingletonProfileManager.activateProfile() --> ProfileService.activateProfile("deploy-hasingleton")

One call to activateProfile() leads to another nested call.

Below is an example of ignoring the validation in a re-entrant call. (This is based on doctoring AbstractProfileService rev 83388 before you change validate() to limit validation to a single context.)


  | private final ThreadLocal<Boolean> reentrantActivate = new ThreadLocal<Boolean>();
  | 
  | public void activateProfile(ProfileKey key) throws Exception
  | {
  |       ...
  | 
  |       ProfileContext context = this.registeredProfiles.get(key);
  |       if(context == null)
  |          throw new NoSuchProfileException("No such profile: "+ key);
  | 
  |       Boolean reentrant = reentrantActivate.get();
  |       reentrantActivate.set(Boolean.TRUE);
  |       try
  |       {
  |          try
  |          {
  |             log.info("Activating profile: " + context.getProfile());
  |             controller.change(context, ControllerState.INSTALLED);         
  |          }
  |          catch(Throwable t)
  |          {
  |             throw new RuntimeException(t);
  |          }
  |       
  |          // Check if the profile was activated successfully 
  |          if (Boolean.TRUE.equals(reentrant) == false)
  |          {
  |             validate();
  |          }
  |       }
  |       finally
  |       {
  |          reentrantActivate.set(reentrant);
  |       }
  | }

This validation thing is a pain in general; I vaguely recall some discussion with Scott about a similar issue a year or two back. Perhaps we should move away from automatically validating and instead make it part of the SPI?  Let the caller decide when they want a validation check and what to validate?

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

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



More information about the jboss-dev-forums mailing list