This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch: FYI: Fix for PR 4859


Hi,

On Tue, Nov 13, 2001 at 04:31:55PM -0700, Tom Tromey wrote:
>  
> +    /**
> +     * This method returns <code>true</code> if the queue has been
> +     * stopped.
> +     */
> +    public synchronized boolean isStopped ()
> +    {
> +      return this.heap == null;
> +    }
>    }				// TaskQueue
>  
>    /**
> @@ -337,8 +345,9 @@
>  		}
>  	    }
>  
> -	  // Calculate next time and possibly re-enqueue
> -	  if (task.scheduled >= 0)
> +	  // Calculate next time and possibly re-enqueue.
> +	  // Don't bother re-scheduling if the queue has been stopped.
> +	  if (! queue.isStopped () && task.scheduled >= 0)
>  	    {
>  	      if (task.fixed)
>  		{

This fix still has a (very small) chance of generating the same "bug".
If the timer is stopped between the !queue.isStopperd() and the
queue.enqueue(task) then you will still get the IllegalStateException.

A better fix would be to actually try to reschedule the task and catch
(and ignore) the exception.

2001-11-16  Mark Wielaard  <mark@klomp.org>

        * java/util/Timer.java (TaskQueue.isStopped): Remove method.
        (Scheduler.run): Try to re-schedule task and ignore exception if
        queue has been stopped.

OK to commit?

Cheers,

Mark
-- 
Stuff to read:
    <http://www.toad.com/gnu/whatswrong.html>
  What's Wrong with Copy Protection, by John Gilmore

Attachment: Timer.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]