<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 17 Dec 2010, at 11:41, Vladimir Blagojevic wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<div bgcolor="#ffffff" text="#000000">
Even better this way. I would like to hear more about your reasoning
behind using DT on per-cache basis. Yes, it would be simpler and
easier API for the users but we do not cover uses cases when
distributed task execution needs access to more than one cache
during its execution....<br></div></blockquote><div><br></div><div>I was just wondering whether such a use case exists or whether we're just inventing stuff. :-) It would lead to a much more cumbersome API since you'd need to provide a map of cache names to keys, etc.</div><br><blockquote type="cite"><div bgcolor="#ffffff" text="#000000">
<br>
On 10-12-16 9:07 AM, Manik Surtani wrote:
<blockquote cite="mid:C15493B0-9F24-458E-A96D-C1CFA6F1B38F@jboss.org" type="cite"><br>
<div>
<div>Hmm. Maybe it is better to not involve an API on the
CacheManager at all. Following JSR166y [1], we could do:</div>
<div><br>
</div>
<div>DistributedForkJoinPool p =
DisributedForkJoinPool.newPool(cache); // I still think it
should be on a per-cache basis</div>
<div><br>
</div>
<div>DistributedTask<MyResultType, K, V> dt = new
DistributedTask<MyResultType, K, V>() {</div>
<div> </div>
<div> public void map(Map.Entry<K, V> entry, Map<K,
V> context) {</div>
<div> // select the entries you are interested in.
Transform if needed and store in context</div>
<div> }</div>
<div><br>
</div>
<div> public MyResultType reduce(Map<Address, Map<K,
V>> contexts) {</div>
<div> // aggregate from context and return value.</div>
<div> };</div>
<div><br>
</div>
<div>};</div>
<div><br>
</div>
<div>MyResultType result = p.invoke(dt, key1, key2, key3); //
keys are optional.</div>
<div><br>
</div>
<div>What I see happening is:</div>
<div><br>
</div>
<div>* dt is broadcast to all nodes that hold either of {key1,
key2, key3}. If keys are not provided, broadcast to all.</div>
<div>* dt.map() is called on each node, for each key specified
(if it exists on the local node).</div>
<div>* Contexts are sent back to the calling node and are passed
to dt.reduce()</div>
<div>* Result of dt.reduce() passed to the caller of p.invoke()</div>
<div><br>
</div>
<div>What do you think? </div>
<div><br>
</div>
<div><br>
</div>
<div>[1] <a moz-do-not-send="true" href="http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166ydocs/index.html">http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166ydocs/index.html</a></div>
<div>--</div>
</div>
<div>
<div>
<div>Manik Surtani</div>
<div><a moz-do-not-send="true" href="mailto:manik@jboss.org">manik@jboss.org</a></div>
<div><a moz-do-not-send="true" href="http://twitter.com/maniksurtani">twitter.com/maniksurtani</a></div>
<div><br>
</div>
<div>Lead, Infinispan</div>
<div><a moz-do-not-send="true" href="http://www.infinispan.org/">http://www.infinispan.org</a></div>
<div><br>
</div>
</div>
<br class="Apple-interchange-newline">
</div>
<br>
</blockquote>
<br>
</div>
</blockquote></div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div><div>--</div><div>Manik Surtani</div><div><a href="mailto:manik@jboss.org">manik@jboss.org</a></div><div><a href="http://twitter.com/maniksurtani">twitter.com/maniksurtani</a></div><div><br></div><div>Lead, Infinispan</div><div><a href="http://www.infinispan.org">http://www.infinispan.org</a></div><div><br></div></div></span><br class="Apple-interchange-newline">
</div>
<br></body></html>