[infinispan-dev] Distributed execution framework - API proposal(s)
Vladimir Blagojevic
vblagoje at redhat.com
Thu Jan 13 14:48:16 EST 2011
On 11-01-11 11:45 AM, Manik Surtani wrote:
> And for the distributed executor API, how's this as an alternative
> (suggested by Eduardo earlier)?
>
> DistributedExecutorService extends ExecutorService [1], adds
> overloaded methods of submit(Callable) with submit(Callable, K...).
> In keeping with the ExecutorService contract, submit() will ensure
> the Callable is executed just once, on any one node. We could add a
> submitEverywhere(Callable) and submitEverywhere(Callable, K...) to
> mean execution on _all_ nodes.
>
> Also ships with a DistributedCallable which extends Callable, adds
> setCache() and setEmbeddedCacheManager() setters. If the callable is
> a DistributedCallable, then these setters are called before
> Callable.call(); otherwise just do Callable.call().
>
> WDYT?
>
> [1]
> http://download.oracle.com/javase/6/docs/api/java/util/concurrent/ExecutorService.html
>
Ok no problem but I'd prefer to have one setter
setDistributedTaskContext that has access to caches and input keys. WDYT?
public interface DistributedTaskContext<K, V> {
public Collection<K> inputKeys();
/**
* Retrieves the default cache associated with this context.
* <p/>
*
* @return the associated cache.
*/
Cache<K, V> getCache();
/**
* Allows access to an arbitrary cache where this
DistributedTaskContext is being provided
*
* @param <T>
* @param <R>
* @param cacheName
* @return
*/
<T, R> Cache<T, R> getCache(String cacheName);
/**
* Returns Infinispan address where this DistributedTaskContext is
being provided
*
* @return
*/
Address getExecutionNode();
}
More information about the infinispan-dev
mailing list