-
1. Re: No "preDeregister" execution on Server shutdown
adrian.brock Mar 21, 2002 5:42 AM (in response to susan)The service controller calls the falling methods
void stop();
void destroy();
It doesn't unregister() any other MBeans.
Are you using ServiceMBeanSupport?
Regards,
Adrian -
2. Re: No "preDeregister" execution on Server shutdown
susan Mar 21, 2002 7:04 AM (in response to susan)Hi!
I tried the ServiceMBeanSupport in this way:
public class MyMBean extends org.jboss.util.ServiceMBeanSupport implements MyMBeanMBean
//Attributes, Operations ...
public void postDeregister()
{
}
public void preDeregister()
{
...
}
//ServiceMBeanSupport
public void stop()
{
preDeregister();
}
//ServiceMBeanSupport
public String getName()
{
return name;
}
...
But it doesn't execute the preDeregister() (wrapped in stop() ) on server shutdown.
On startup in the logs: [13:00:32,749,ConfigurationService$ServiceProxy] DefaultDomain:name=myMBean does not implement any Service methods
I think, I didn't implement it right??
Thank you! -
3. Re: No "preDeregister" execution on Server shutdown
adrian.brock Mar 21, 2002 7:34 AM (in response to susan)You need the following:
[pre]
public interface MyMBeanMBean
extends org.jboss.util.Service
{
your management interface
}
[/pre]
[pre]
public class MyMBean
extends org.jboss.util.ServiceMBeanSupport
implements MyMBean
{
Your manangement implmentation
public String getName()
{
return whatever;
}
public void createService()
{
Allocate my resources
}
public void startService()
{
Link to resources in other MBeans
}
public void stopService()
{
Unlink resources in other MBeans
}
public void destroyService()
{
Release my resources
}
}
[/pre]
You can omit some methods.
ServiceMBeanSupport provides empty implementations.
e.g.
public void destoyService()
{
}
preDeregister isn't used during the normal service lifecycle.
Regards,
Adrian -
4. Re: No "preDeregister" execution on Server shutdown
adrian.brock Mar 21, 2002 7:36 AM (in response to susan)Sorry,
It should be
public class MyMBean
extends org.jboss.util.ServiceMBeanSupport
implements MyMBeanMBean
Regards,
Adrian -
5. Re: No "preDeregister" execution on Server shutdown
susan Mar 21, 2002 8:54 AM (in response to susan)Thanks a lot!!!
It really works!!!
So I did the functionality of my "postRegistration" in startService() and of "preDeregistration" in stopService().
In one of my trials, I didn't delete the postRegister() method, and implemented the necessary methods from ServiceMBeanSupport. So during the startup, the postRegister() method has been executed, although there were the createService() and startService() methods.
So my Conclusion is, that the ServiceMBeanSupport doesn't overwrite the "registerMBean()" method of MBeanServer, but add any methods.
Is this right?
Ok, I will thank you a second time!
Susan -
6. Re: No "preDeregister" execution on Server shutdown
adrian.brock Mar 21, 2002 9:16 AM (in response to susan)I'm not sure I understand the question.
You might want to look at the JBoss source for more
details.
Regards,
Adrian