-
1. Re: Custom service seems to be ignoring <depends> tag
toddjtidwell Oct 27, 2006 4:25 AM (in response to toddjtidwell)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
genman Oct 27, 2006 3:57 PM (in response to toddjtidwell)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
toddjtidwell Oct 27, 2006 4:01 PM (in response to toddjtidwell)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
toddjtidwell Oct 27, 2006 6:57 PM (in response to toddjtidwell)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 { }