javaee / hk2

A light-weight and dynamic dependency injection framework
https://javaee.github.io/hk2
Other
112 stars 83 forks source link

Run Level Service: support optional concurrency of services #360

Closed hankipanky closed 6 years ago

hankipanky 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

Closing this as this issue is migrated to https://github.com/eclipse-ee4j/glassfish-hk2/issues/361