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() ).
- 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>
);
That's it.
Have fun - Mad Andy / Better Pizza
Senior Java Developer
eBuilt Inc. (www.ebuilt.com)
while( true ) { think(); write(); publish(); }
----- Original Message -----
From: "Peter Antman" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 06, 2000 8:31 AM
Subject: [jBoss-User] Timer Mbean - how to get at it
> Hi,
> I am trying to build some fun stuff around jboss, MBeans and the new
> MessageDriven beans.
>
> I would like to use the javax.management.Timer to do some message
> thinks. But how do I get access to it? I can't figure that out.
>
> If I add it to the jboss.conf file it starts ok. But it does not bind to
> JNDI, or if it does, no one knows.
>
> I have tried using the nice MBeanProxy to get access to it, and that
> also works fine, with one minor flaw: you can only add stuff to time,
> but no listeneres to get the event sent to, since the API for this is
> not part of the TimerMBean interface.
>
> So how do I get access to the real Timer, so I can add
> NotificationListeners?
>
> Richard, any clue here?
>
> //Peter
>
> --
> Jobba hos oss: http://www.tim.se/weblab
> ------------------------------------------------------------
> Peter Antman Technology in Media, Box 34105 100 26 Stockholm
> Systems Architect WWW: http://www.tim.se
> Email: [EMAIL PROTECTED] WWW: http://www.backsource.org
> Phone: +46-(0)8-506 381 11 Mobile: 070-675 3942
> ------------------------------------------------------------
>
>
>
> --
> --------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Problems?: [EMAIL PROTECTED]
>
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]