如何在jboss启动时就创建该server的实例

03-07-25 lunxian

要完成一个后台server的东东,希望在jboss启动时该server也启动。该server是通过一个独立类实现的,使用Singleton模式。另外通过在一个ejb中引用该server(通过getInstance),为其他client端如sp/servlet完成server的配置等功能。问题是现在如何在jboss启动时就创建该server的实例?

Jevang
2003-07-25 11:52

Define MBean, then set it in user-server.xml

lunxian
2003-07-25 16:53

用Mbean对组件编写有什么特殊要求?

如果只是用我现在的实现,是否只需要在user-service.xml上部署一下就行了,不需要我在代码上特殊处理才行?

Jevang
2003-07-25 23:18

It has to be a MBean, which is not a big deal for you: a xxxMBean interface and a few lifecycle management related methods, you can keep them dummy.

This is actually make sense as normally you want to control the resource established during startup, the best way to expose its methods is thru JMX.

WL does not require startup class be a MBean, but I still keep it that way.

Cheers

-Jevang