Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-1086

IndexOutOfBoundsException for DistributedExecutorService with a single node cache

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • 5.0.0.CR2
    • 5.0.0.CR1
    • Core
    • None
    • Hide
      DefaultCacheManager caches = new DefaultCacheManager(GlobalConfiguration.getClusteredDefault());
      caches.defineConfiguration("distexec", new FluentConfiguration(new Configuration()).mode(Configuration.CacheMode.DIST_ASYNC).build());
      Cache cache = caches.get("disexec");
      DistributedExecutorService executor = new DefaultExecutorService(cache);
      executor.execute(new Runnable(){ @Override public void run(){/**anything*/ }  });
      

      not exactly the code i use but should be identical

      Show
      DefaultCacheManager caches = new DefaultCacheManager(GlobalConfiguration.getClusteredDefault()); caches.defineConfiguration( "distexec" , new FluentConfiguration( new Configuration()).mode(Configuration.CacheMode.DIST_ASYNC).build()); Cache cache = caches.get( "disexec" ); DistributedExecutorService executor = new DefaultExecutorService(cache); executor.execute( new Runnable (){ @Override public void run(){ /**anything*/ } }); not exactly the code i use but should be identical

      I'm just trying the distributed executor in 5.0.0.CR1. My first test is to start a cache with one member only (but with clustered cache configuration as it is required). When I submitted a runnable in to a DistributedExecutorService with a single node, it got an error:

        java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
           	at java.util.ArrayList.RangeCheck(ArrayList.java:547)
           	at java.util.ArrayList.get(ArrayList.java:322)
           	at org.infinispan.distexec.DefaultExecutorService.randomClusterMemberOtherThanSelf(DefaultExecutorService.java:451)
           	at org.infinispan.distexec.DefaultExecutorService.execute(DefaultExecutorService.java:278)
      

      there is only one member and no "cluster member other than self". Should the single node use case be supported? I suppose there is no harm to allow user to use the executor in a single node, for example, for unit testing.

      if this use case is not supported, I suggest to throw an exception with better explanation

              vblagoje Vladimir Blagojevic (Inactive)
              mingfai_jira Ming Fai Ma (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: