Going to reply to this in multiple parts; since we have a large email here and many points we agree on. Martin Desruisseaux wrote: > Runnable or Callable can be extended with a cancel() method. This is > what I'm pushing for. I have the feeling that our disagreement come > from the fact that the following recommandation doesn't seem an option > in your proposal: > > http://java.sun.com/javase/6/docs/technotes/guides/concurrency/threadPrimitiveDeprecation.html > > > Please scroll down to "What should I use instead of Thread.stop?" I completly agree with that example to wit this part is right on the money: > Most uses of |stop| should be replaced by code that simply modifies > some variable to indicate that the target thread should stop running. That said their example code is out of date; it depends on "blinker = null;" being atomic ... it is because of reasons like this that the *only* design example from Sun that I trust for this stuff in the JDK is the Future/Callable example.
Martin we are in agreement here; there are two good ways to stop a thread: - Using a Future - Using a flag that the Runnable checks to see if it should exit (as shown in your above example) WRONG: Trying to use any Thread method - yes you could use Thread.interrupt exactly as shown in the Future implementation; but the risk is not worth it The preference for both of us is to raise a flag that the Runnable checks. Jody ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ Geotools-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
