Hi Marc

Of course you can do but this is a similar questions like why does JBoss
(<yeahh/>) use JMX to call methods on other MBeans through JMX
and not by using JNDI.
First of all some people asked for that but I think that JMX has one big
advantage over the EJB route is that you do not have to know which
class or interface the service implements, you just have to find the service
and then call its method (but of course there is no guarantee).

For the timer you can go either way (locally). But remotely you do not have
to distribute classes which can be also a disadvantage (as we saw with
Proxies).

To give you an example now we use the ServiceControl MBean to startup
the JBoss components but later on you can easily replace this (let's say) a
new version of the DependencyManager. When you use your approach then
at least both have to implement the same Interface (which they do now but
this doesn't have to be).

Yes, JMX is slow and untyped but it is flexible, so what do you prefer?

BTW, the EJB route or idea is that EJBs live on the network but should a
JMX service really live on the network. In general I say that it is bound
locally
to its MBeanServer or should (as example) an EJB container become an
object living on the wire?

Have fun - Andy
----- Original Message -----
From: "marc fleury" <[EMAIL PROTECTED]>
To: "jBoss" <[EMAIL PROTECTED]>
Sent: Friday, December 08, 2000 8:04 PM
Subject: RE: [jBoss-User] Timer Mbean - how to get at it


> again
>
> can't we go the EJB route and offer admin in JNDI like any other bean ?
>
> ?
>
> marc
>
>
> |-----Original Message-----
> |From: [EMAIL PROTECTED]
> |[mailto:[EMAIL PROTECTED]]On Behalf Of Andy "Mad"
> |Schaefer
> |Sent: Thursday, December 07, 2000 5:29 PM
> |To: jBoss
> |Subject: Re: [jBoss-User] Timer Mbean - how to get at it
> |
> |
> |----- Original Message -----
> |From: "Peter Antman" <[EMAIL PROTECTED]>
> |To: <[EMAIL PROTECTED]>
> |Sent: Wednesday, December 06, 2000 11:53 PM
> |Subject: Re: [jBoss-User] Timer Mbean - how to get at it
> |
> |
> |>
> |> Thanks,
> |>
> |> On  6 Dec, Andy "Mad" Schaefer wrote:
> |> > Hi
> |> >
> |> > Yes, I know that I already promissed to create a HowTo on the time
> |> > issue but I didn't got the time.
> |> > But for short there's the way (I assume that you are in the same JVM
> |> > as jBoss is running):
> |> > - Add a <MLET> tag to jBoss.conf loading
"javax.management.timer.Timer"
> |> > - Get a reference to the MBeanServer. If you are in a MBean then you
> |> >    get it for free (during pre or post registration) otherwise you
have
> |it
> |> >    to get it from JNDI or through MBeanFactory.getMBeanServer() ).
> |>
> |>
> |> What is the JNDI name?
> |Sorry, but the JMX Connector on the server-side is registered on the JNDI
> |server to make him accessible over the network (like a person in the
phone
> |directory). Have a look at the org.jboss.jmx.server.RMIConnector (I
think)
> |to finds its JNDI name.
> |
> |> > - Get the ObjectInstance through the MBeanServer like:
> |> >    Set lBeans = lBeanServer.queryMBeans(
> |> >         new ObjectName( "DefaultDomain", "service", "timer" ),
> |> >         null
> |> >     );
> |> >     if( !lBeans.isEmpty() ) {
> |> >         ObjectInstance lTimerBean = (ObjectInstance)
> |> > lBeans.iterator().next();
> |> > - use addNotification() on the Timer to set what you are interested
in:
> |> >     lBeanServer.invoke( lTimerBean.getObjectName(),
"addNotification",
> |> >         new Object[] { <List of parameters see JavaDoc> },
> |> >         new String[] { <List of parameters data type> }
> |> >     );
> |> > - add yourself as a Notification Listener:
> |> >     lBeanServer.addNotificationListener(
> |> >         lTimerBean.getObjectName(), <your listener instance>
> |> >     );
> |> >
> |>
> |>
> |> Here is an alternative (at least it seems to work for mee):
> |>
> |>
> |>
> |> 1. Ad listeners:
> |>
> |>
> |> MBeanServer server = (MBeanServer) MBeanServerFactory.
> |>
> |findMBeanServer(null).iterator().next();
> |>
> |>
> |> server.addNotificationListener(new ObjectName("Timer:service=Timer"),
> |>        listener,
> |>        filter,
> |>        o);
> |>
> |> 2. Add stuff to time:
> |>
> |> timer =
> |(TimerMBean)MBeanProxy.create(TimerMBean.class,"Timer:service=Timer");
> |> timer.addNotification("test", "testing",
> |>   null, new java.util.Date(new java.util.Date().
> |>                                      getTime() +Timer.ONE_MINUTE  )
> |>                                         );
> |>
> |>
> |> With MLET set to:
> |> <MLET CODE = "javax.management.timer.Timer" ARCHIVE="jmxri.jar"
> |NAME="Timer:serv
> |> ice=Timer" CODEBASE="../../lib/">
> |> </MLET>
> |>
> |> //Peter
> |I think that will work as well. Andy
> |
> |
> |
> |
> |--
> |--------------------------------------------------------------
> |To subscribe:        [EMAIL PROTECTED]
> |To unsubscribe:      [EMAIL PROTECTED]
> |Problems?:           [EMAIL PROTECTED]
> |
> |
>
>
>
> --
> --------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Problems?:           [EMAIL PROTECTED]
>



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to