1 2 3 Previous Next 35 Replies Latest reply on Oct 24, 2011 3:51 PM by lmcdasi Go to original post
      • 30. Re: can I avoid a service to block as7 startup ?
        jason.greene

        Dan Sirbu wrote:

         

        Well, the Framework depends "ok" on the SubsystemState. And since they run on the same thread the Framework will wait until Subsytem finishes.

         

        The problem comes from the fact that the SubsystemState has NO clue how many modules are to be set. Thus it does not know how many adds need to be performed in order for the Subsystem Model to be created ok. The adds are comming in parallel with the SubsytemState start method .....

        SubsystemState is an internal OSGi implementation class. It's not meant to be used for anything other than that.

        • 31. Re: can I avoid a service to block as7 startup ?
          lmcdasi

          Yes - I am aware that such a service exists. The thing is that I have to provide service to not only one WAR file but to ALL war file that get deployed. Then why not using the ME functionality - it looks the right way to deploy services used by other WAR,RAR,EAR,SAR etc .... And it WORKS as long as I do fix this.

           

          Anyhow, the issue is still here and solving it will help other that would like to create ME's.

          There is definitively an unsync happening between the two threads. And I do not think I miss something when I create the Subsytem. I think I have done my homework ..... ok    ..... I gues

           

          I did not meant that I am using the OSGI SubsystemState class ..... I just looked at how things are done by other people otherwise how one can learn.

           

          Thus if one looks there, the issue should be similar. Their Framework will start BEFORE the SubsytemState can populate the module from the ModuleAdd - that must happen there too ! Their stateService.addModule from the addStep will happen within the "Controller Boot Thread" and necesserely before the Framework "MSC service" - just  as it does for me and thus the other services may or may not get the right stuff - all depending on thread sync !

           

          Then they do things differently but that issue, in my humble opinion, looks to be there. Unfortunately there are no logs that can be enabled to show that. Anyhow - that is what I think based on what I have as a result - but I can be wrong.

           

          And anyway the issue is clear - framework can not have a proper SubsystemState until the stateService.addModule from the addStep completes !!! And that is in NO SYNC with the "MSC Thread".

           

          BR,

          Dan S.

           

           

          • 32. Re: can I avoid a service to block as7 startup ?
            lmcdasi

            Let me take a different approach. When I create a ME I can define/build a subsystem having configration, properties, etc...

            The subsystem can have runtime changes via jboss-admin.sh. Any objections ?

             

            Now, the subsystem can be build when reading the standalone.xml file OR having a runtime subsystem state - at my understanding. Any objections ?

             

            Then the subsystem state is updated at runtime via OperationStepHandler && "registerOperationHandler(ModelDescriptionConstants.ADD .....", etc.

             

             

            Now, my question is how a ME service can get the subsystem state after the all operation handlers on that subsystem have been performed ?

             

            • 33. Re: can I avoid a service to block as7 startup ?
              jason.greene

              MSC services are global, so having them deployed in a jar via service activator will result in every WAR etc being able to see them.

               

              Glancing at the OSGi implementation, they appear to use a nested step with all services created in that steps context which is al added to the SVH. So the completion of that step will block until the core Framework service has completed

              • 34. Re: can I avoid a service to block as7 startup ?
                lmcdasi

                Yes - that works ok.

                 

                The issue that I have is that one "add" operation comes after my framework start and I am getting a concurrent exception when accessing a list built within the subsystem state. Here are the traces that I am getting :

                 

                23:54:32,026 INFO  [<myPkg>.TestSubsystemAdd] (Controller Boot Thread) Activating Test Subsystem
                23:54:32,031 INFO  [<myPkg>.MyBootstrapService] (Controller Boot Thread) Test MyBootstrapService - created
                23:54:32,031 INFO  [<myPkg>.MySubsystemState] (MSC service thread 1-3) MySubsystemState - started
                23:54:32,031 INFO  [<myPkg>.TestAdd] (Controller Boot Thread) TestAdd --> execute Add                                  <<<<< this is OK
                23:54:32,031 INFO  [<myPkg>.MyBootstrapService] (MSC service thread 1-10) Test MyBootstrapService - starting.
                23:54:32,032 INFO  [<myPkg>.MyBootstrapService] (MSC service thread 1-10) Test MyBootstrapService - started in:0ms.
                23:54:32,033 INFO  [<myPkg>.TestAdd] (Controller Boot Thread) TestModuleAdd --> execute Add                       <<<<< that comes out of sync

                I do not understand why the last execute Add occurs AFTER the bootstrapservice started. And I am wondering how this is getting synchronized between the MSC service thread && the Controller Boot Thread. I do not get where I am messing it up !

                I used the proper dependency when I add the bootstrap service towards the runtime subsystem state.

                 

                If you have an idea - it will be more than welcomed.

                 

                BR,

                Dan S.

                • 35. Re: can I avoid a service to block as7 startup ?
                  lmcdasi

                  To solve my sync problem what I did is that in the readElement I build add to the state the info that I need. Then when the runtime operation occurs just after the bootime the Add operation is silently discarded since the element has been already built when doing readElement. In this way the ME will get the right definition and no concurrent changes occurs. Then if one uses jboss-admin.sh to change the state it still can since an Add operation is defined at runtime.

                   

                  Though: that does not make understand well (or at all) how the Add operation from the OperationStepHandler is synchronized when the AS boots adn changes state from bootime to runtime. I have look at how other people do and I do not see how they synchronize that state change when they build a ME state.

                   

                  1 2 3 Previous Next