Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Shared ScheduledExecutorService #10

Closed
savageautomate opened this issue Dec 3, 2012 · 3 comments
Closed

Shared ScheduledExecutorService #10

savageautomate opened this issue Dec 3, 2012 · 3 comments
Assignees
Milestone

Comments

@savageautomate
Copy link
Member

Add ability to pass external executor service
(for example: it can be done by passing ScheduledExecutorServiceFactory to GpioFactory).

There also should me method like GpioController.getScheduledExecutorService if someone would use already created thread pool.

@kermitas
Copy link

kermitas commented Dec 4, 2012

Some minor thougts:

  • when external ScheduledExecutorService was passed - Pi4J should not shutdown it on it's own shutdown (because this resource is managed by somebody, somewhere else).
  • when Pi4J internal ScheduledExecutorService is provided to external world (for example by GpioController.getScheduledExecutorService) is should not allow to be shuted down by anybody else than Pi4J (this can be done by returning ScheduledExecutorService inside wrapper - ScheduledExecutorServiceWrapper - where shutdown() and shutdownNow() throws UnsupportedOperationException)

@savageautomate
Copy link
Member Author

Good suggestions and I agree with your points. Need to do some refactoring to address these.

@savageautomate
Copy link
Member Author

Added support for this feature in the latest 0.0.5-SNAPSHOT (2013-02-09) build.

There is a new ExecutorServiceFactory implementation that allow users to provide their own executor service factory where you users can create the executors and manage own thread pool. Users can assign their own ExecutorServiceFactory implementation via the GpioController.

See https://github.com/Pi4J/pi4j/tree/develop/pi4j-core/src/main/java/com/pi4j/concurrent for more details.

mheath pushed a commit to mheath/pi4j that referenced this issue Feb 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants