-
1. Re: problem removing a notification from timer mbean
mikeklem May 23, 2003 4:06 AM (in response to blakbox)What type of object is lOneMinuteTimer?
-
2. Re: problem removing a notification from timer mbean
adrian.brock May 23, 2003 8:01 AM (in response to blakbox)It is an Integer.
Use Integer.class.getName();
Regards,
Adrian -
3. Re: problem removing a notification from timer mbean
blakbox May 23, 2003 10:41 AM (in response to blakbox)lOneMinuteTimer is the Integer object that results from adding the notification:
Date lNext = new Date(new Date().getTime() + Timer.ONE_MINUTE);
Integer lOneMinuteTimer =(Integer) lServer.invoke(
lTimer.getObjectName(),
"addNotification",
new Object[] {
"IDoNotKnowWhatTypeIs",
"I call you with this timer",
null,
lNext,
new Long(30000),
new Long(0)
},
new String[] {
"".getClass().getName(),
"".getClass().getName(),
"java.lang.Object",
Date.class.getName(),
Long.TYPE.getName(),
Long.TYPE.getName()
}
); -
4. Re: problem removing a notification from timer mbean
blakbox May 23, 2003 3:40 PM (in response to blakbox)now i'm using Integer.class.getName() and it works fine.
But I have a question:
in the previous addNotification code, there's Long.TYPE.getName()
instead of Long.class.getName(), but works without problem.
Why is the reason?
great thanks -
5. Re: problem removing a notification from timer mbean
adrian.brock May 25, 2003 8:10 AM (in response to blakbox)Because some methods take an
java.lang.Integer rather than an int
Others take a long rather a java.lang.Long
Regards,
Adrian -
6. Re: problem removing a notification from timer mbean
blakbox May 25, 2003 10:06 AM (in response to blakbox)Hi,
I'm saying in the code few posts above, there's new Long(0), and next Long.TYPE.getName() in its corresponding signature. So Long.TYPE.getName represents the type long, not Long. However it's still working.
I'm sorry if I haven't explained very well.
Thanks. -
7. Re: problem removing a notification from timer mbean
adrian.brock May 26, 2003 7:03 AM (in response to blakbox)That will because it does it via Method.invoke.
You pass a java.lang.Long, but declare it as
long. It will be converted.
Regards,
Adrian