- All Implemented Interfaces:
- ij.plugin.PlugIn
public class Equality_Example
extends Object
implements ij.plugin.PlugIn
An example that demonstrates one potential peril of the Cluster ExecutorService.
The assumption of deep equality across submission of a Callable is broken when
using Cluster.submit() because it relies on Serialization, unlike any other typical
ExecutorService. In other words, a submitted Callable is Serialized, then sent over
a network stream to the remote machine on which is it call()'ed. The result of that
call is Serialized remotely, then returned, also via a network stream. This means
that even though new is not explicitly called, the get() method on the corresponding
Future will return a freshly minted object, whose member variables will also be freshly
minted, and so forth.
Call run() either with or without a Cluster running to see the difference. This class
also illustrates a potential workaround for this problem, using a HashMap.