eclipse-ee4j / glassfish-hk2

Dynamic dependency injection framework
https://eclipse-ee4j.github.io/glassfish-hk2
Other
84 stars 57 forks source link

Run Level Service: support optional concurrency of services #361

Open glassfishrobot opened 7 years ago

glassfishrobot commented 7 years ago

As discussed here, I'd like to kindly ask for an enhancement which would allow me to execute services with optional concurrency.

Ideally, I'd like an annotation like this:

@Service
@RunLevel(value = 3, concurrency = 5)
public class MyConcurrentService {
  ...

In theory, this could be achieved by defining a custom Executor and registering it with the RunLevelController service. However, the Executor is not aware of how specifically it is supposed to be executing the passed Runnable.

Also, as far as I understand, RunLevel services are always of Singleton scope. This may lead to unexpected behaviour when destroying a service multiple times (going down in run-levels).

glassfishrobot commented 6 years ago