[infinispan-dev] concurrency issue on ServiceLoader::iterator

Manik Surtani manik at jboss.org
Wed May 16 10:16:29 EDT 2012


Is this still an issue?

On 9 May 2012, at 16:55, Ales Justin wrote:

> Anyone ever seen this error?
> 
> Caused by: java.util.NoSuchElementException
> 	at java.util.AbstractList$Itr.next(AbstractList.java:350) [classes.jar:1.6.0_31]
> 	at java.util.Collections$1.nextElement(Collections.java:3389) [classes.jar:1.6.0_31]
> 	at java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:332) [classes.jar:1.6.0_31]
> 	at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:415) [classes.jar:1.6.0_31]
> 	at org.infinispan.distexec.spi.DistributedTaskLifecycleService.onPreExecute(DistributedTaskLifecycleService.java:50) [infinispan-core-5.2.0-SNAPSHOT.jar:5.2.0-SNAPSHOT]
> 
>   public <T> void onPreExecute(Callable<T> task) {
>      try {
>         Iterator<DistributedTaskLifecycle> i = loader.iterator();
>         while (i.hasNext()) { // <------------------------------------------------- we CHECK before
>            DistributedTaskLifecycle cl = i.next();
>            cl.onPreExecute(task);
> 
> And I doubt I have multiple thread accessing it at the same time -- running this from serial testsuite.
> 
> I can reproduce this, atm, almost every time, where Vladimir (Blagojevic; Infinispan - author of DistributedTaskLifecycleService) cannot.
> 
> Any idea?
> 
> -Ales
> 
> 
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev

--
Manik Surtani
manik at jboss.org
twitter.com/maniksurtani

Lead, Infinispan
http://www.infinispan.org






More information about the infinispan-dev mailing list