classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Nasty problem in javax.swing.Timer.restart()


From: Joao Victor
Subject: Re: Nasty problem in javax.swing.Timer.restart()
Date: Thu, 10 Nov 2005 19:35:53 +0000

I have to agree with you on that, Mark.

While i was trying to detect/fix the problem, i thought i was going
nuts with all the timers, and controlling every wait/notify.

I even started changing ToolTipManager to use a util.Timer instead,
but stopped when i found out (i didn't knew) that if you call
timer.cancel() or timer.schedule() twice on the same task, it gives
you an exception; and that kinda broke what i had in mind (and it was
pretty late already ;))

Cheers,
J.V.



2005/11/10, Mark Wielaard <address@hidden>:
> Hi,
>
> On Thu, 2005-11-10 at 19:26 +0100, Meskauskas Audrius wrote:
> > Thanks for idea. The problem seems real and the solution may work.
>
> Yes, thanks Joao. I agree the problem is real. The queueLock is used for
> multiple things that are not completely related (guarding the queue
> variable and guarding Timer running status). But I am afraid we have to
> do a more radical rewrite of this class. Reading some bits about how
> swing Timers are used suggests that they should/can just use one Thread
> for all Timers you create. And that makes sense since I assume swing
> Timers are often used so creating/destroying a Thread each time a Timer
> is instantiated might be a bit much overhead. We should then make this
> Thread a daemon thread so when all other Threads stop the program
> properly terminates. I believe our util Timer code is pretty much what
> we want here. Util Timer uses a heap of TimerTasks to makes finding the
> next task to fire O(1) and inserting new tasks O(logn). One Util Timer
> can then be shared by all Swing Timers which just register TimerTasks
> with it. But maybe I am over-engineering here (I wrote Util Timer, so I
> am biased. I also introduced this bug in Swing Timer so I am also a bit
> embarrassed).
>
> We clearly need more (mauve) tests for this class.
>
> Cheers,
>
> Mark
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2 (GNU/Linux)
>
> iD8DBQBDc5+YxVhZCJWr9QwRAgBFAJ0QeG9Ed9Ckk1gcazsfWOMRq7yBAwCff8BT
> fMe4dqcz+RhImRBoEcwnGII=
> =6mBo
> -----END PGP SIGNATURE-----
>
>
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]