1 Reply Latest reply on May 22, 2012 10:46 AM by Mike Brock

    Errai 2.0.0 final: ActivityProcessor throws IllegalArgumentException on pc with 1 CPU

    Lau Bakman Newbie

      Hi

       

      I have a virtual machine where I do some testing with Errai at home and today I wanted to use the MonitorExtension. To my surprise the MonitorExtension fails to load with an IllegalArgumentException.

       

      So far I have narrowed it down to ActivityProcessor line 34 where a new ThreadPoolExecutor is created. The instantiation requires a minimum of 2 threads (corePoolSize) and provides the result of Runtime.getRuntime().availableProcessors() as the argument to maximumPoolSize.

       

      In my case I only have a single CPU configured for my virtual machine making the ThreadPoolExecutor throw the exception as corePoolSize is now larger than maximumPoolSize.

       

      I can work around this by reconfiguring my VM to use 2 CPU's but I figured that it would probably be better to change the code to handle 1 CPU.

       

      (Even if it is just by doing new ThreadPoolExecutor(2, (Runtime.getRuntime().availableProcessors() >= 2 ? Runtime.getRuntime().availableProcessors() : 2), ...);)

       

      Regards

       

      Lau Bakman