<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Re: can I avoid a service to block as7 startup ?
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/lmcdasi">Dan Sirbu</a> in <i>JBoss AS7 Development</i> - <a href="http://community.jboss.org/message/631639#631639">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>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 ...)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>So, I think I have done that ok but it looks like I have some issues.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>The problem must be around here :</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="text-decoration: underline;">SubsystemState</span>:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><a class="jive-link-anchor-small">#</a></p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p align="left"><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-size: 10pt;"><p align="left"> <strong style="color: #7f0055; font-size: 10pt;"><strong style="color: #7f0055; font-size: 10pt;">public</strong></strong><span style="font-size: 10pt;"> </span><strong style="color: #7f0055; font-size: 10pt;"><strong style="color: #7f0055; font-size: 10pt;">static </strong></strong><span style="font-size: 10pt;">ServiceController<SubsystemState> addService(<span style="font-size: 10pt;">ServiceTarget serviceTarget, Activation activation) {  // activation is forced to eager</span></span></p></span><span style="font-size: 10pt;"><p align="left"><p align="left"><div align="left"><span style="font-size: 10pt;"><p align="left">     SubsystemState state = <strong style="color: #7f0055; font-size: 10pt;"><strong style="color: #7f0055; font-size: 10pt;">new </strong></strong><span style="font-size: 10pt;">SubsystemState(); // will this be the object that will be injected into the FrameworkBootstrapService ?!?</span></p><p align="left">     state.setActivation(activation);</p></span></div></p></p></span></p></p><p><a class="jive-link-anchor-small">#</a></p><p><div><span style="font-size: 10pt;"><p align="left"><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></p></span></div></p><p><span style="font-size: 10pt;"><p align="left">     ServiceBuilder<SubsystemState> builder = serviceTarget.addService(<em style="color: #0000c0; font-size: 10pt;"><em style="color: #0000c0; font-size: 10pt;">SERVICE_NAME</em></em><span style="font-size: 10pt;">, state);<span style="font-size: 10pt;"><span style="font-size: 10pt;"> </span> };</span></span></p></span><span style="font-size: 10pt;"><strong style="color: #7f0055; font-size: 10pt;"><strong style="color: #7f0055; font-size: 10pt;">protected</strong></strong><span style="font-size: 10pt;"> </span><strong><span style="color: #7f0055; font-size: 10pt;">void</span><span style="font-size: 10pt;"> performBoottime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) {<span style="font-size: 10pt;"> </span></span><span style="font-size: 10pt;"><p align="left">     context.addStep(<strong style="color: #7f0055; font-size: 10pt;"><strong style="color: #7f0055; font-size: 10pt;">new </strong></strong><span style="font-size: 10pt;">AbstractDeploymentChainStep() {</span></p></span><p><div> </div></p></strong></span></p><p align="left">     builder.setInitialMode(Mode.<em style="color: #0000c0; font-size: 10pt;"><em style="color: #0000c0; font-size: 10pt;">ACTIVE</em></em><span style="font-size: 10pt;">);</span></p><p align="left"><span style="font-size: 10pt;">     <strong style="color: #7f0055; font-size: 10pt;"><strong style="color: #7f0055; font-size: 10pt;">return</strong></strong><span style="color: #000000; font-size: 10pt;"> builder.install()</span></span><p align="left"><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></p><p align="left"><span style="font-size: 10pt;"></span></p><p align="left"><p align="left"><span style="text-decoration: underline;">SubsystemAdd</span>:<span style="font-size: 10pt;"> </span></p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></p><p><p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><div> </div></p><span style="font-size: 10pt;"><p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><strong style="color: #7f0055; font-size: 10pt;"><strong style="color: #7f0055; font-size: 10pt;">     protected</strong></strong><span style="font-size: 10pt;"> </span><strong style="color: #7f0055; font-size: 10pt;"><strong style="color: #7f0055; font-size: 10pt;">void</strong></strong>  <span style="font-size: 10pt;">execute(DeploymentProcessorTarget processorTarget) {<span style="font-size: 10pt;"><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></span></span><p align="left"><span style="color: #3f7f5f; font-size: 10pt;"><p align="left"><span style="color: #3f7f5f; font-size: 10pt;">           // Add deployment dependency on the WAR/RAR/SAR applications</span></p></span></p><span style="font-size: 10pt;"><p align="left">           processorTarget.addDeploymentProcessor(Phase.</p></span><em style="color: #0000c0; font-size: 10pt;"><em style="color: #0000c0; font-size: 10pt;">           DEPENDENCIES</em></em><span style="font-size: 10pt;">, Phase.</span><em style="color: #0000c0; font-size: 10pt;"><em style="color: #0000c0; font-size: 10pt;">DEPENDENCIES_MODULE</em></em><span style="font-size: 10pt;">, </span><strong style="color: #7f0055; font-size: 10pt;"><strong style="color: #7f0055; font-size: 10pt;">new </strong></strong><span style="font-size: 10pt;">DependencyProcessor()); </span></p><span style="font-size: 10pt;"><p align="left"><p align="left">     }</p><span style="font-size: 10pt;"><p align="left">}, OperationContext.Stage.</p></span></p></span><em style="color: #0000c0; font-size: 10pt;"><em style="color: #0000c0; font-size: 10pt;">RUNTIME</em></em> <span style="font-size: 10pt;">); </span></span></p><p><p align="left"><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p align="left">ServiceTarget serviceTarget = context.getServiceTarget();</p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">  </p></p></p><p><span style="color: #3f7f5f; font-size: 10pt;"><p align="left"><span style="color: #3f7f5f; font-size: 10pt;">// Add the Subsystem State service - it will hold subsystem <span style="text-decoration: underline;">config</span>. Activation is EAGER for both.</span></p></span></p><p><span style="font-size: 10pt;"><p align="left">newControllers.add(SubsystemState.<em>addService</em>(serviceTarget, getActivationMode(operation)));</p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">  </p></span></p><p><span style="color: #3f7f5f; font-size: 10pt;"><p align="left"><span style="color: #3f7f5f; font-size: 10pt;">// Add the service - all modules will be handled via the service</span></p></span></p><p><span style="font-size: 10pt;"><p align="left">newControllers.add(<span style="text-decoration: underline;"><span style="text-decoration: underline;">FrameworkBootstrapService.<em>addService</em></span></span><span style="text-decoration: underline;"><span style="text-decoration: underline;">(serviceTarget, verificationHandler</span></span><span style="text-decoration: underline;">)</span>);</p></span><p><p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></p></p><p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><p><span style="font-size: 10pt;"><p><p align="left"><span style="font-size: 10pt;">So, to me, it looks like I am doing the right stuff. BUT ......</span></p><p align="left"><p align="left"><p style="min-height: 8pt; height: 8pt; padding: 0px;">  </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">  </p></p></p></p></span></p><a class="jive-link-anchor-small">#</a><a class="jive-link-anchor-small">#</a></p><p>     </p><div class="mcePaste" id="_mcePaste" style="position: absolute; top: 45px; left: 0px;"></div></p><p><p>}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></p><p><span style="font-size: 10pt;"><p><span style="text-decoration: underline;">FrameworkBootstrapService</span>: - <em>dependency towards the SubsystemState added</em>.</p><p><span style=": ; font-size: 2;"></span><strong><span style=": ; color: #7f0055; font-size: 2;"><p>private</p><p><span style="font-size: 10pt;"><strong style=": ; color: #000000; font-size: 10pt;"></strong></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style=": ; font-size: 2;"><span style="font-size: 10pt;"><span style="font-size: 2;"><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></span><strong style="color: #7f0055; font-size: 10pt;"><strong style="color: #7f0055; font-size: 10pt;">public</strong></strong><span style="font-size: 10pt;"> </span><strong style="color: #7f0055; font-size: 10pt;"><strong style="color: #7f0055; font-size: 10pt;">static</strong></strong><span style="font-size: 10pt;"> ServiceController<FrameworkBootstrapService> addService(</span><strong style="color: #7f0055; font-size: 10pt;"><strong style="color: #7f0055; font-size: 10pt;">final</strong></strong><span style="font-size: 10pt;"> ServiceTarget target, </span><strong style="color: #7f0055; font-size: 10pt;"><strong style="color: #7f0055; font-size: 10pt;">final</strong></strong><span style="font-size: 2;"> ServiceListener<Object>... listeners) {</span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p align="left">FrameworkBootstrapService service = </p></span><strong style="color: #7f0055; font-size: 10pt;"><strong style="color: #7f0055; font-size: 10pt;">new</strong></strong><span style="font-size: 2;"> FrameworkBootstrapService();</span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p align="left">ServiceBuilder<FrameworkBootstrapService> builder = target.addService(</p></span><em style="color: #0000c0; font-size: 10pt;"><em style="color: #0000c0; font-size: 10pt;">SERVICE_NAME</em></em><span style="font-size: 2;">, service);</span></span></span><span style="font-size: 2;"><p align="left"><span style="text-decoration: underline;">builder.addDependency(SubsystemState.</span></p></span><em style="color: #0000c0; font-size: 10pt;"><em style="color: #0000c0; font-size: 10pt;">SERVICE_NAME</em></em><span style="font-size: 10pt;">,SubsystemState.</span><strong style="color: #7f0055; font-size: 10pt;"><strong style="color: #7f0055; font-size: 10pt;">class</strong></strong><span style="font-size: 10pt;">, service.</span><span style="color: #0000c0; font-size: 10pt;">injectedSubsystemState</span><span style="font-size: 2;">);</span><span style=": ; font-size: 2;"><span style="font-size: 2;"><p><p align="left">builder.addListener(listeners);</p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></p><span style="font-size: 2;"><p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></p></span></span><strong style="color: #7f0055; font-size: 10pt;"><strong style="color: #7f0055; font-size: 10pt;">return</strong></strong><span style="font-size: 10pt;"> builder.install();<p>}</p></span></span></p></span><span style="color: #000000; font-size: 10pt;"> </span><strong style="color: #7f0055; font-size: 10pt;"><strong style="color: #7f0055; font-size: 10pt;">final</strong></strong><span style="color: #000000; font-size: 10pt;"> InjectedValue<SubsystemState> </span><span style="color: #0000c0; font-size: 10pt;">injectedSubsystemState</span><span style="color: #000000; font-size: 10pt;"> = </span><strong style="color: #7f0055; font-size: 10pt;"><strong style="color: #7f0055; font-size: 10pt;">new</strong></strong><span style="color: #000000; font-size: 10pt;"> InjectedValue<SubsystemState>();</span></strong></p></span></p></p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/631639#631639">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss AS7 Development at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>