[concurrency-interest] question about ExecutorCompletionService

Hanson Char hanson.char at gmail.com
Thu Aug 31 10:09:49 EDT 2006


How about:

public class ExecutorCompletionService<V> implements CompletionService<V> {
...
    // return whatever Executor as the caller wish
    public <E extends Executor> E getExecutor() {
        return executor;
    }
}

Hanson

On 8/31/06, Rémi Forax <forax at univ-mlv.fr> wrote:
>
> Dhanji R. Prasanna a écrit :
> > How about using generics to type ExecutorCompletionService?
> > Something like:
> >
> > class ExecutorCompletionService<EX extends Executor, V> {
> > //...
> >
> > EX getExecutor()..
> >
> > }
> >
> > then you could do:
> > ecs = new ExecutorCompletionService<ExecutorService, ..>(..);
> > ecs.getExecutor().isTerminated();
> >
> > It's not much but you avoid the ugly cast.
>
> Not possible, the new ExecutorCompletionService will be not
> backward compatible with the old one.
>
> In Java, there is a compatibility between raw type
> (type without type parameter) and parameterized type
> but not between parameterized type with 1 parameter and
> parameterized type with 2 parameters.
>
> Rémi Forax
>
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at altair.cs.oswego.edu
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20060831/a5d970d7/attachment.html 


More information about the Concurrency-interest mailing list