Michael Doube wrote:
>
http://doube.org/plugins.html#purify>
> I'm working on improving my coding style, so any suggestions you have
> are appreciated.
For multithreading, I discovered about a year ago the Executors,
ExecutorService, Future, and Callable classes that make multithreading
dead-easy.
For example:
ExecutorService exec =
Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
class DoSomething implements Callable<ImagePlus> {
public ImagePlus call() {
// generate an image
ImagePlus imp = new ImagePlus("that", new FloatProcessor(500, 500));
return imp;
}
}
Future<ImagePlus> fu = exec.submit(new DoSomething());
// blocks until it's done:
ImagePlus result = fu.get();
result.show();
// when done:
exec.shutdown();
It's very convenient to operate over very large collections of objects
or operations.
Albert
--
Albert Cardona
http://albert.rierol.net