Re: repaint method and design question
John B. Matthews wrote:
Yes, the SDN article is referenced in Component, and perhaps elsewhere.
I finally figured that out, after spending some quality time with the Javadocs.
It doesn't help that some of that outrigger documentation has been superseded,
but the docs don't reflect the new knowledge.
... there are stochastic models where no synchronization at
all gives satisfactory results.
Lew wrote:
How do variable values communicate across threads in that case?
Or by "stochastic" do you mean that it doesn't matter, because the
results are intended to be random?
John:
Yes, the results evolve in apparent random order: many kinds of
fractals; diffusion limited aggregation, which has a fractal character;
any iteration over a set of lattice points in which you don't care that
some points are from iteration n-1 and some from iteration n.
But without synchronization, the display thread might only see iteration zero
forever.
I really do wonder how one handles the memory-model concerns in that
"stochastic models" scenario. Would you be so gracious as to explain?
My point was only that sometimes it doesn't matter if the model is
changing under you. When it matters, you have to synchronize access, of
But don't model changes by very necessity have to be communicated somewhere,
eventually? Absent synchronization, either via the 'synchronized' keyword or
via any of the several other mechanisms that Java provides, there is no
guarantee in the memory model that those changes would ever escape to another
thread that needs them.
And if another thread doesn't need them, then it's not a multithreaded scenario.
I'm not sure failing to communicate model state actually contributes to the
stochasticism.
Sorry if I seemed to be arguing to the contrary.
You are not.
Oh, and I hope I am always gracious!
You are so.
--
Lew