Sorry it's a little bit long, you can skip to the Problem section if you want to know what I think the problem is :
I am experiencing some problems with our MBean ( which acts like a scheduler by depending on the TimerMBean ), this happens after we upgraded to to JBoss 3.x from JBoss 2.4.4 ( we are currently using JBoss 3.2.3, Java 1.4_02 ) :
The MBean's function is to provide a level of abstraction that would allow people to schedule things either in certain intervals or daily at certain times ( I did not implement this but was called in when this problem occurs, although I think JBoss has this functionality in the scheduler ). Anyway when I schedule things using the scheduled intervals, everything seems to be ok, but if I use the daily at certain times setting, it would not work.
Here's a brief description of the architecture :
1. An abtract superclass that implements the scheduling activity ( above ) by using NotificationFilter, etc
2. Other MBeans would then extend from this abstract superclass.
I've traced through the problem as best as I can and my suspicion lies with the mechanics of the NotificationFilter. It's my understanding that when you do an addNotificationListener with a filter, that filter is going to be invoked when there's a notification for that listener. The way we implemented our NotificationFilter is by following the example on the JMX book ( by Fleury and Lindfors ) where we construct the Filter by passing in the NotifID we get by adding a Notification to the server and then comparing that ID with the TimerNotification.getIdentificationID method when the isNotificationEnabled is called.
The Problem as far as I can see is that :
the Notification is sent, but the correct NotificationFilter is never used such that the Listener never receives any Notification whatsoever. Strangely this works for the interval use case and we use the same NotificationFilter, same type, etc
Here's a snippet of log that caused my suspicion :
[createUseSetClockTimes] 22 Added Notification: Thu Jan 22 16:43:00 PST 2004 14
( The number at the very back refers to the NotificationId I get from the MBeanServer after calling the addNotification function on the TimerMBean, this NotifID is then passed in to the constructor of my Filter, refer to above for details )
[createUseSetClockTimes] 22 Added Notification: Thu Jan 22 16:48:00 PST 2004 15
And then here is where I see that the Notification is sent :
INFO [NVLScheduledProcess] ===============> [NvlTimerFilter] timer.notification 14 received in filter: 1
2004-01-22 16:43:01,943 INFO [NVLScheduledProcess] The details of the notification : javax.management.timer.TimerNotification: type=timer.notification.useSetTime source=DefaultDomain:service=timer sequence=2 time=1074818580707 message================> Timer invokes MBean Successfully id=14 userData=null
14 refers to the TimerNotification.getNotificationID and 1 refers to the FilterID ( which is actually the ID of a NotificationID ).
I also notice that JBoss keeps using Filters with ID 1, 22, 23, 24 and nothing else which is certainly possible but why not ID 14 for this particular Listener.
Am I using the TimerMBean wrongly or is this a bug ? Anyone who can shed light on this is highly appreciated.