reschedule method of Timer utility in Muse will give illegal state exceptions
-----------------------------------------------------------------------------

                 Key: MUSE-154
                 URL: http://issues.apache.org/jira/browse/MUSE-154
             Project: Muse
          Issue Type: Bug
          Components: Utilities - General, QName, and XML
    Affects Versions: 2.0.0, 2.1.0
         Environment: any
            Reporter: Mohammad Fakhar
         Assigned To: Dan Jemiolo
            Priority: Minor


The reschedule method of Timer utility gives the following error upon execution:
java.lang.IllegalStateException: Task already scheduled or cancelled
        at java.util.Timer.sched(Timer.java:331)
        at java.util.Timer.schedule(Timer.java:157)

Here is the scenario:

1) I schedule a resource for termination at time X using the scheduled life 
time capability.
2) 5 seconds later, I re-schedule the same resource for termination at time Y 
(where Y is > X).
3) The lifetime capabilites use the Timer utility underneath the covers and 
upon rescheduling, the reschedule
method is called in SimpleScheduledTermination implementation: 
_terminationTimer.reschedule(time);

4) The reschedule method cancels the task, creates a new instance of a timer 
and schedules the SAME instance of the task with the new timer:
Timer.reschedule {
        ............
         cancel();
        _timer = new java.util.Timer();
        schedule(whenToFire);
}

Timer.schedule {
          ..........
        _timer.schedule(_task, whenToFire);

}

5) Now, java.util.Timer doesn't allow you to schedule the same instance of a 
previously cancelled task EVEN with a new timer instance (I experimented with 
it on the side). This is not explicit in the jdk javadoc, but it won't allow 
you to do this. Not sure if this should be a jdk bug or not, but I thought I 
would get it documented here at least. 

6) this problem will surface whenever Muse implements the WS-N Renew function.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to