> Hello,
>
[quoted text clipped - 37 lines]
>
> Sam N Seaborn
I would think that you would want all the clocks to update at the same
instant. In that case I would use one timer and write your list of
times or update the graphics of all clocks at the same time. It will be
more difficult to synchronize the actions of multiple thread than a
single thread or timer.

Signature
Knute Johnson
email s/nospam/knute/
On Jul 21, 3:08 am, sam.n.seab...@gmail.com wrote:
> Hello,
>
[quoted text clipped - 37 lines]
>
> Sam N Seaborn
I would say that all timezones are relative to each other, and that
you only really need one "clock", to notify when you need to update.
For the text based version, you can even use java.util.Timer, instead
of dealing with Thread.sleep yourself. And for the graphical version,
you could use javax.swing.Timer, and have your timer simply tell your
clocks to repaint. The each "clock" should be its own component, and
it should override the paintComponent method to draw the actual clock,
based on the current time appropriate for the timezone.
This eliminates the need to handle multiple threads almost completely,
and inexperienced use of threading/synchronizing is cause too many
bugs. Specifically, Swing is designed to be SINGLE THREADED, you are
never supposed to interact with a Swing based object on any thread
except the Event Dispatch Thread.
Whatever approach you take, I strongly suggest at least reading the
sun tutorial: <http://java.sun.com/docs/books/tutorial/uiswing/
concurrency/index.html>
After that, I also suggest getting and reading the book "Java
Concurrency In Practice" <http://www.javaconcurrencyinpractice.com/>.
cyprian - 23 Jul 2007 12:06 GMT
> On Jul 21, 3:08 am, sam.n.seab...@gmail.com wrote:
>
[quoted text clipped - 60 lines]
> After that, I also suggest getting and reading the book "Java
> Concurrency In Practice" <http://www.javaconcurrencyinpractice.com/>.
1. create a central thread, the utc timezone thread.
2. Create an edt thread whose parent is the utc thread, getXXX()
methods come here that convert utc to edt
3. Create an nzst thread whose parent is the edt thread, converting to
specifics as appropriate.
4. When utc thread is stopped, it sends a signal that reverberates
through the chain.
Why: that way locking on any timer thread is avoided and
synchronization differs not according to lock but according to machine
variations because all the threads have the same priority. when utc
thread is stopped, all other threads get stopped automatically. this
is just a plan of action. itching to implement it myself.
question really intriguing.