I construct a timer, addNotificationListener, addNotification with no errors or nothing suspicious. I never see the call to my handleNotification method. What else do I need to do?
environment: JBoss 4.0.3, Win 2003, HSQLDB
....
import javax.management.Notification;
import javax.management.NotificationListener;
import javax.management.timer.Timer;
...
....
timer=new Timer();
timer.addNotificationListener(this, null, myObject); // null, no filter
timer.addNotification("ExpectedUsage", "ExpectedUsage", myObject, nextExpire, periodMs);
....
public void handleNotification(Notification notif, Object myObject)
{
System.out.println("timer fired");
}
timer.start() is missing!
did it.
I did not realize that you had to call a start method. I thought adding a notification started it.