12 Replies Latest reply on Jul 8, 2003 4:14 PM by Viet

    JDBCDeploymentScanner patch

    timothyb Newbie

      Julien,

      When a block is removed the records in nuke_service_attributes are left behind. I didn't think this was a big deal, but is was creating some issues for me. Attached is a simple patch for the remove function.

      tim

        • 1. Re: JDBCDeploymentScanner patch
          Viet Master

          oh you're playing with that feature ? can you provide feedback ?

          I will integrate the patch, so when a block is removed, leaving attached attributes is an option.

          julien

          • 2. Re: JDBCDeploymentScanner patch
            timothyb Newbie

            If you make it an option, that will work fine. I was just experinceing some weird behavior deploying/undeploying. I tried removing the service attributes and everything worked perfect.

            In order to configure the poll block as it is deployed the polls module needs to listen for its registration, and then set some properties, side, weight, etc. For some reason having those attributes in the table already was scrambling the Page as it tried to deploy/undeploy the block. It is working now though, I can deploy a block on the fly with user configured properties.

            The way nukes deploys the blocks as MBeans looks like its going to work really well. I struggled with how I could set the blocks properties on the fly for about a day, but after reading the JMX spec the solution was straight forward.

            I just noticed an issue that occurs when jboss gets started up, and nukes loads blocks persisted in the nuke_services table. I'm going to look a that now.

            tim

            • 3. Re: JDBCDeploymentScanner patch
              timothyb Newbie

              I isolated the problem that occurs when nukes loads persisted blocks. For some reason, if the Side attribute is 2, nukes will display the block twice, and then blow up when the block is undeployed. The problem occurs with the test block in JDBCDeploymentScanner also.

              • 4. Re: JDBCDeploymentScanner patch
                Viet Master

                cool to see it works... he it is supposed to work but I did just few tests.

                julien

                • 5. Re: JDBCDeploymentScanner patch
                  timothyb Newbie

                  Julien,

                  I found a problem in CoreModule that occurs when the system is loading a block that waspersisted to the database. If the side attribute is anything other than 0, CoreModule will add it to the blocks list twice. This is because the AttributeChanged notification gets triggered, and then the componentStarts function also adds the block to the list. I've attached a patch to this post. I'm not sure the patch is the proper way to fix the problem, but it's what I'm using to develop with.

                  tim

                  • 6. Re: JDBCDeploymentScanner patch
                    Viet Master

                    ok I will integrate the patches tonight, I am working on security and need to finish that before.

                    • 7. Re: JDBCDeploymentScanner patch
                      timothyb Newbie

                      This problem with the block adding twice only happens if a block is persisted because JDBCDeploymentScanner calls syncAttribute for side. If the JBoss main deployer alone is involved in the registration only the state attribute changes.

                      The way nukes uses JMX notifications is cool, I'm starting to understand the whole JBoss thing a litttle better now that I've seen how nukes is architected.

                      tim

                      • 8. Re: JDBCDeploymentScanner patch
                        Viet Master

                        I commited the first patch, not the second one yet because it seem you are not using the latest version of nukes from cvs.

                        I remember having corrected such a problem and maybe the latest cvs is not buggy. Could you try to get the latest cvs and try in the dupicate problem occurs ?

                        Also I thing we are going to do an alpha 2 release soon. You told me you are working on Poll module. Are you far from having finished it ? So I could include it in the release.

                        julien

                        • 9. Re: JDBCDeploymentScanner patch
                          timothyb Newbie

                          If you want to be sure about the problem try this short test. Deploy the test block in JDBCDeploymentScanner, and then run some sql to set the Side attribute to 2.

                          update nuke_services_attributes set pn_value='2'
                          where pn_sid='nukes.blocks:name=test' and
                          pn_aid='Side'

                          Now restart jboss or nukes. When I do this without the patch, I get two test blocks on the right side. I have trimmed the patch down a bit and it is now only one line. There is a probably a better way to fix this, but I'm afraid to mess with anything else.

                          Also, after I pulled all the latest source down, I can't access any of the modules, even though I'm logged in as admin?

                          I am working on the polls module, and should have the core of it in less than a week. I'm making good progress now.

                          tim

                          • 10. Re: JDBCDeploymentScanner patch
                            Viet Master

                            you are right, now it is corrected but I did it slightly differently.

                            the problem came from the fact that notifications may happend before a block triggers the componentStart operation of the core module. So when the core module adds it in an array it supposes that the block has never been seen before, which is wrong.

                            So when a component starts the block is checked to be in another array with the sideToBlock map.

                            A potential problem may happen : if a component triggers the component stop and then see its side changed that will register it against the arrays and nothing will remove it later. We have to think about this (rare) case, which results in a bad manipulation of the lifecycle. Indeed if you stop a component for removal you are not supposed to change one of its attributes.

                            I commited the change to the cvs. I know that sf.net has some problem for the user to get a really fresh cvs working copy. Let me know if you need that I send you the file

                            Thanks for pointing out this problem.

                            julien

                            • 11. Re: JDBCDeploymentScanner patch
                              Noel Rocher Apprentice

                              Hi all,

                              I have not a lot of time to give and my block contribution is very slow.

                              But, if you want to see block's general property dynamycally changing you can try the block module as it is right now and give me feedback.

                              Julien, I need some help to understand how to change blocks properties (you suggested to look at the ServiceConfigurator but it was not clear to me). Any more idea ?

                              • 12. Re: JDBCDeploymentScanner patch
                                Viet Master

                                good to read from you noel !

                                could you be clearer , I don't remember... sorry.
                                if you want to change a block property, use the server.setAttribute(ObjectName, Attribute) method.

                                julien