On 30 Jul 2010, at 17:10, Vladimir Blagojevic wrote:
On 2010-07-30, at 11:50 AM, Manik Surtani wrote:
>
> On 30 Jul 2010, at 16:36, Vladimir Blagojevic wrote:
>
>>> * Proposed interfaces - Not sure if I understand the purpose of
DistributedCallable#mapped(). You already assign a cache to the callable in
DistributedCallable#initialized(), right?
>>
>> The intent of initialized call was to bootstrap task into environment at the
master node, the node invoking the distribution of callables. The purpose of initialize is
two fold. Task implementor can look up input that was given to it in constructor of
DistributedCallable and interpret this input (e.g which keys to use, which particular
cache etc etc) and in turn inform execution environment which cache it would use for data
input so proper ConsistentHash can be passed in preferredExecutionNodes by the
environment. I wanted to isolate task implementor from digging deep into Infinispan
internals to figure out how to fulfill preferredExecutionNodes contract.
preferredExecutionNodes is invoked while task is still at master node before migration to
execution node.
>
> Not sure I understand. If you are passing in a reference to the cache the Callable
is executed on (in mapped()) and you are passing in a ConsistentHash in
preferredExecutionNodes(), what is the purpose of initialized()? Why would a Callable
need a reference to the Cache instance at the "master node", as you put it?
Sure, sure. I complicated it unnecessarily :)
We might need only one callback on master node. But how do we do design it properly to
accommodate the need of the task to do some task input interpretation using interaction
with cache and return list of preferred execution nodes at the same time?
This is why I think the task should not care about nodes. :) The task should just be
concerned with data.
How about just
DistributedCallable#getRelatedKeys(EmbbededCacheManager cm)?
I still don't see why you need to pass it the cache manager. Perhaps:
DistributedCallable {
Set<K> getRelatedKeys();
void mappedToNode(Cache<K, V> cache);
}
--
Manik Surtani
manik(a)jboss.org
Lead, Infinispan
Lead, JBoss Cache
http://www.infinispan.org
http://www.jbosscache.org