As mentioned here, Guava ServiceManager can be obtained by
ServiceManager manager = injector.getInstance(ServiceManager.class);
To make this work, I added the following in my Guice module:
@Provides
public Set<Service> services(){
return ImmutableSet.<Service>of(MyService());
}
In my main class,
ServiceManager manager = injector.getInstance(ServiceManager.class);
manager.startAsync().awaitHealthy();
How do I get instances of the started services?
p.s. Setting the services to be @Singleton feels like a hack.