-
Notifications
You must be signed in to change notification settings - Fork 446
Exception in thread "main" java.util.concurrent.RejectedExecutionException #31
Comments
Hi Andy, some of the program code got cut off, can you please paste the rest of it (or link to it if you have it in a public repository). Thanks, Robert |
Hello, package atael; import com.pi4j.io.gpio.GpioController; public class Pi4JGPIOPins {
} On Sun, Jan 27, 2013 at 10:48 AM, Robert Savage notifications@git.luolix.topwrote:
|
The class GpioScheduledExecutorImpl creates a ThreadPoolExecutor with a queue size of 5 You are submitting 16 jobs to the queue. The queue will be full after submitting only 5 jobs, then the Executor will start rejecting jobs. It would seem to me that the size of the Executors queue should be at least equal to the number of gpio pins. You could change the size of the Executors queue in the pi4j code or you could use this code, which would need to go into it's own thread to be useful. this code doesn't quite do what you had coded, but I think it does what you intended - 50ms on then 50ms off on all pins. while(true) |
I am working on the scheduled executors issue. Another workaround may be to use the new blocking pulse function that was added in 0.0.5-SNAPSHOT. GPIOPinOut[i].pulse(50); Since you are pulsing for 50 ms and then sleeping for 50 ms, I think this could be simplified using this single line and removing the sleep statement. The "true" argument will cause the pulse to block for the pulse duration. GPIOPinOut[i].pulse(50, true); This pulse() blocking call does not use the scheduled executor and will return a null future object. The real issue of limited thread needs to be addressed in the project, but I think this will get it working for your particular situation. Thanks, Robert |
Robert, --Andy |
I am reopening the issue because the limited number of threads needs to be addressed in a future build. |
Fixed in latest 0.0.5-SNAPSHOT (2013-02-09) build. New build includes enough threads in the pool by default to handle all the RPi GPIO pins. |
Hello,
I have written up a little program (well modified one I saw on pi4j.com) using Pi4J-0.0.5 (downloaded here: http://code.google.com/p/pi4j/downloads/detail?name=pi4j-0.0.5-SNAPSHOT.zip) and run into an issue which I am not sure how to debug or correct?
My environment is:
The error looks like this:
And the code looks like this:
Any idea what could be wrong?
Thanks,
Andy
The text was updated successfully, but these errors were encountered: