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]