4 Replies Latest reply on Oct 27, 2006 6:57 PM by Todd Tidwell

    Custom service seems to be ignoring <depends> tag

    Todd Tidwell Newbie

      I've written a several custom services according to all the examples. This has worked fine for me and has made my life a much better place. However, I have found myself duplicating code, so in an effort to avoid that, I did this:

      public abstract class CustomerService
      {

      }

        • 1. Re: Custom service seems to be ignoring <depends> tag
          Todd Tidwell Newbie

          Well, that was stupid. Hit submit instead of preview.

          Here we go again:

          I've written several custom services. However, I'd like them all to extend one base class, like so:

          public abstract class CustomService
          extends ServiceMBeanSupport
          {
           //... Some sort of shared functionality
          }
          


          Then, I extend that for my actual service, like so:

          public interface MyServiceMBean
          extends ServiceMBean
          {
          
          }
          
          public class MyService
          extends CustomService
          {
          
          }
          


          In my jboss-service.xml I have:

          <mbean code="test.MyService" name="test:service=MyService">
           <depends>test:service=ServiceIDependOn</depends>
          </mbean
          


          Now, this all deploys incredibly well and functions if I deploy it while JBoss is running. However, if I restart JBoss, MyService does *not* wait for it's dependency to deploy. However, if I stop extending CustomService, this all works fine.

          Any ideas?

          • 2. Re: Custom service seems to be ignoring <depends> tag
            Elias Ross Master

             

            
            public class MyService
            extends CustomService
             *IMPLEMENTS* CustomServiceMBean
            {
            
            }
            


            Not sure it matters, but I think you need the implements part.

            • 3. Re: Custom service seems to be ignoring <depends> tag
              Todd Tidwell Newbie

              Good catch. Actually, that was a typo on my part. You're right, I do need the implements bit. However, the problem still exists.

              It deploys fine if I copy the sar in while JBoss is running, but if I start JBoss with the sar already in the deploy directory, it starts the service without honoring the depends.

              • 4. Re: Custom service seems to be ignoring <depends> tag
                Todd Tidwell Newbie

                Just a small update to this:

                It seems I was incorrect in assuming that this was working correctly during a hot deploy. It doesn't matter whether it's a hot or cold deploy, if my dependencies are not deployed, the custom service that depends on them still deploys as long as it extends another object. The second I remove the inheritance, it obeys dependencies again.

                So, the following code obeys the dependencies:

                public class MyService
                implements MyServiceMBean
                {
                
                }
                


                However, this does not:

                public class MyService
                extends SuperService
                implements MyServiceMBean
                {
                
                }