-
1. Re: MBean to start external services
adrian.brock Jul 15, 2002 1:40 PM (in response to blairj)You can do whatever you like in an MBean.
Not sure about the rest? An ejb is really for business
logic not systems programming.
Regards,
Adrian -
2. Re: MBean to start external services
marc.fleury Jul 15, 2002 1:57 PM (in response to blairj)Actually I will disagree with you there adrian, I think EJBs are wonderful system constructs :) failover, remoteness, threading, transactional.. hmmm nice system you got there
For example the HTTPSession clustering was done leverage this -
3. Re: MBean to start external services
adrian.brock Jul 15, 2002 2:30 PM (in response to blairj)Yes, mbeans can create ejbs to distribute state across
a cluster and take advantage of all the other features
provided by the container.
I don't think blairj was talking about the same thing?
Regards,
Adrian -
4. Re: MBean to start external services
blairj Jul 16, 2002 7:33 PM (in response to blairj)No actually I was thinking of being able to call the MBean from my EJB when I needed to restart the external services. I'm not sure if this is legal / available / etc. (sorry I am just learning about MBeans so I don't really know all of the limitations to them).
Thanks,
blairj -
5. Re: MBean to start external services
sgturner Jul 16, 2002 7:47 PM (in response to blairj)Calling an MBean from an EJB is doable. Two ways to do it, but I don't know which is better.
1. Write an extra MBean that registers your MBean with Jn di. Then in EJB, get reference to MBean from Jndi.
2. In EJB, get reference to MBeanServer directly and use it to invoke a method on your MBean
Perhaps someone else has other suggestions or an opinion as to which of these 2 ways is best. I've done both. #1 was the hardest in terms of figuring out what to code. -
6. Re: MBean to start external services
adrian.brock Jul 17, 2002 6:20 AM (in response to blairj)Invoking an MBean from an ejb is both possible and
valid.
I just don't think that using an ejb to monitor/restart
system functions is correct usage.
Regards,
Adrian -
7. Re: MBean to start external services
blairj Jul 17, 2002 3:19 PM (in response to blairj)This is an external service which connects to the jndi tree and sometimes the native code which it accesses burps and takes the JVM with it. So inorder to have failover capablities my EJBs need to be able to restart these external services when they need them. I know this probaly is not the best solution but it seems to be only one which conforms to the J2EE spec.
-
8. Re: MBean to start external services
schaefera Jul 18, 2002 3:41 AM (in response to blairj)That is excatly what MEJB from JSR-77 is doing.
BUT be aware that a EJB using MBeans depends on the server implementation in how to find the MBeanServer so it isn't vendor-neutral anymore (at least as long as JMX is not part of J2EE).
Andy -
9. Re: MBean to start external services
blairj Jul 18, 2002 12:31 PM (in response to blairj)But as long as the container supports JMX it should not be a problem then right? The only two app servers which I have to worry about are JBoss 3 and WebSphere 5 ( it also supports JMX as I understand).