[concurrency-interest] question about ExecutorCompletionService

Rémi Forax forax at univ-mlv.fr
Thu Aug 31 09:35:28 EDT 2006


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



More information about the Concurrency-interest mailing list