Hi
When adding the notifications, sometimes the timer mbean is throwing the folowing exception.
java.lang.IllegalArgumentException: Timer notification date before the current
ate
at javax.management.timer.Timer.addNotification(Timer.java:434)
at javax.management.timer.Timer.addNotification(Timer.java:548)
at java.lang.reflect.Method.invoke(Native Method)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1
30)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1
25)
We are passing the following arguments to the addNotification method of the timer mbean.
Object[] objectArray = {"testa", "TEST", data, new Date(System.currentTimeMillis())};
String[] stringArray = { "java.lang.String", "java.lang.String", "java.lang.Object", "java.util.Date"};
server.invoke(objectName,"addNotification",objectArray,stringArray);
Could you please tell me the solution to get rid of this exception. One solution is to add some time( 500 milliseconds) so that the current time always exceeds that system current time in the addNotification method which is as follows.
Object[] objectArray = {"testa", "TEST", data, new Date(System.currentTimeMillis()+500)};
String[] stringArray = { "java.lang.String", "java.lang.String", "java.lang.Object", "java.util.Date"};
server.invoke(objectName,"addNotification",objectArray,stringArray);
But, we don't want to use it. Could you please tell me some other solution to solve this issue!!