On 11-04-18 7:58 AM, Manik Surtani wrote:
I still think Mircea's suggestion is very valid. Try cloning
first. If cloning is not supported then serialize/deserialize. And in any case you only
need 1 copy of the callable to send across to all other nodes, and the original copy for
local execution, right?
Even if a type implements Cloneable we can not cast it to Cloneable and
invoke clone as Cloneable is just a marker interface. One can invoke
clone only on types known to implement clone method (ArrayList, Set etc
etc). Yes, if type implements Cloneable we could reasonably assume that
it implemented clone method but still - we have to resort to reflection
to invoke clone method but that route is even worse IMHO. I'd avoid this
altogether.
It is just one copy for local execution. Time it takes to do this is
several magnitudes smaller than the task of migrating Callables around
the cluster executing them and collecting results from all those non
local Callables.
Vladimir