|
The existing ServiceManager based on ServiceProvider does not allow to dynamically configure a service. The current approach forces you to request a concrete implementation from the ServiceManager, instead of asking for a service (a contract/interface). In its current form the service manager is just providing life cycle methods for a given concrete class.
The proposed change the API to request a service to:
<S extends Service> S requestService(Class<S> serviceRole)
Service is just a marker interface and each Service can also implement Startable and Stoppable which gives the service a life cycle. The concept of Service, Startable and Stoppable is taken in this case from ORM.
Another advantage of this approach is, that Java's ServiceLoader can now be used to load implementations of services. This allows for example to dynamically plug in a serialization provider (avro vs java). At the moment the serialization provider is hard coded.
|