Look below code:
@Stateless
| @Local(FidsConJob.class)
| public class FidsConJobBean implements FidsConJob {
| private Timer ConJob;
|
| public void startup() {
| ConJob = ctx.getTimerService().createTimer(new
Date(System.currentTimeMillis()), 6000, "FidsConJob");
| }
|
| @Timeout
| public void timeoutHandler(Timer timer) {
| if(timer.equals(ConJob))
System.out.println("Same timer");
| else
| System.out.println("Different timer");
| }
| }
JBoss 4.0.4 RC1 shows:
anonymous wrote : 11:24:09,630 INFO [STDOUT] Different timer
it means ConJob not equals timer.
Look another below code:
@Stateless
| @Local(FidsConJob.class)
| public class FidsConJobBean implements FidsConJob {
| private Timer ConJob;
|
| public void startup() {
| ConJob = ctx.getTimerService().createTimer(new
Date(System.currentTimeMillis()), 6000, "FidsConJob");
| }
|
| @Timeout
| public void timeoutHandler(Timer timer) {
| if(ConJob.equals(timer))
System.out.println("Same timer");
| else
| System.out.println("Different timer");
| }
| }
JBoss 4.0.4 RC1 shows:
anonymous wrote : 11:27:44,909 ERROR [TimerImpl] Error invoking ejbTimeout:
javax.ejb.EJBException
| : java.lang.NullPointerException
First, timer.equals(ConJob) and ConJob.equals(timer) get different result.
Second, in ejb-3_0-pfd-spec-ejbcore.pdf:
anonymous wrote : 17.2.2 Timeout Callbacks
| If the timed object needs to make use of the identity of the timer to
recognize the significance of the
| timer expiration, it may use the equals method to compare it with any other
timer references it might
| have outstanding.anonymous wrote : 17.2.4 Timer Identity
| The Bean Provider cannot rely on the == operator to compare timers for
?object equality?. The Bean
| Provider must use the Timer.equals(Object obj) method.
I think it's a bug.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3932034#3932034
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3932034
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user