protected void notifyListeners ( final Future < ? > future ) { final List < GenericCompletionListener < ? extends Future < T > > > copy = new ArrayList < GenericCompletionListener < ? extends Future < T > > > ( ) ; synchronized ( this ) { copy . addAll ( listeners ) ; listeners = new ArrayList < GenericCompletionListener < ? extends Future < T > > > ( ) ; } for ( GenericCompletionListener < ? extends Future < ? super T > > listener : copy ) { notifyListener ( executor ( ) , future , listener ) ; } }
Notify all registered listeners with a special future on completion .