[concurrency-interest] question about ExecutorCompletionService

Hanson Char hanson.char at gmail.com
Thu Aug 31 18:17:54 EDT 2006


>     public <E extends Executor> E getExecutor() {
>         return executor;
>     }

should be:

     public <E extends Executor> E getExecutor() {
         return (E)executor;  // casting done here once and for all;
     }

Hanson

On 8/31/06, Hanson Char <hanson.char at gmail.com> wrote:
>
> The difference is you could do something like:
>
>         ExecutorCompletionService ecs  = ...
>         ExecutorService es = ecs.getExecutor();
>
>         if (es.isTerminated()) {
>            ...
>         }
>
> No casting needed.
>
> Hanson
>
> On 8/31/06, Rémi Forax <forax at univ-mlv.fr> wrote:
>
> > Hanson Char wrote:
> >
> > > 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
> >
> > ???,
> > i don't a big difference between
> > (ExecutorService)executionService.getExecutor();
> > and
> > executionService.<ExecutorService>getExceutor(); +an unsafe cast in
> > getExecutor()
> >
> > Rémi
> >
> > _______________________________________________
> > 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/365188ec/attachment.html 


More information about the Concurrency-interest mailing list