JBoss Community

Re: can I avoid a service to block as7 startup ?

created by Dan Sirbu in JBoss AS7 Development - View the full discussion

Yes - I am trying to build a 'very' basic module loader. Instead of having multiple application from my collegues writing their own ME, I could have one ME handling different module startups - obviously with very basic or restricted type of service functionality (like no ejb support within, etc ...)

 

So, I think I have done that ok but it looks like I have some issues.

 

The problem must be around here :

 

SubsystemState:

 

 

 

 

#

 

 

 

public static ServiceController<SubsystemState> addService(ServiceTarget serviceTarget, Activation activation) {  // activation is forced to eager

     SubsystemState state = new SubsystemState(); // will this be the object that will be injected into the FrameworkBootstrapService ?!?

     state.setActivation(activation);

#

 

     ServiceBuilder<SubsystemState> builder = serviceTarget.addService(SERVICE_NAME, state); };

protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) {

     context.addStep(new AbstractDeploymentChainStep() {

     builder.setInitialMode(Mode.ACTIVE);

     return builder.install()

 



SubsystemAdd:

 

 

 

     protected void  execute(DeploymentProcessorTarget processorTarget) {

 

           // Add deployment dependency on the WAR/RAR/SAR applications

           processorTarget.addDeploymentProcessor(Phase.

           DEPENDENCIES, Phase.DEPENDENCIES_MODULE, new DependencyProcessor());

     }

}, OperationContext.Stage.

RUNTIME );

 

ServiceTarget serviceTarget = context.getServiceTarget();

 

// Add the Subsystem State service - it will hold subsystem config. Activation is EAGER for both.

newControllers.add(SubsystemState.addService(serviceTarget, getActivationMode(operation)));

 

// Add the service - all modules will be handled via the service

newControllers.add(FrameworkBootstrapService.addService(serviceTarget, verificationHandler));

 

 

 

So, to me, it looks like I am doing the right stuff. BUT ......

 

 

##

    



}

 

FrameworkBootstrapService: - dependency towards the SubsystemState added.



private



 

 

public static ServiceController<FrameworkBootstrapService> addService(final ServiceTarget target, final ServiceListener<Object>... listeners) {

FrameworkBootstrapService service =

new FrameworkBootstrapService();

ServiceBuilder<FrameworkBootstrapService> builder = target.addService(

SERVICE_NAME, service);

builder.addDependency(SubsystemState.

SERVICE_NAME,SubsystemState.class, service.injectedSubsystemState);

builder.addListener(listeners);

 

 

return builder.install();

}

final InjectedValue<SubsystemState> injectedSubsystemState = new InjectedValue<SubsystemState>();

Reply to this message by going to Community

Start a new discussion in JBoss AS7 Development at Community