So if I understand correctly, I'd in theory simply use DW to manage lifecycle, and hand off to a thread (/pool) that would run the other server. So essentially DW would then provide the health check, admin interface and commands etc.
So it would be something like:
@Override
protected void initialize(TestConfiguration configuration,
Environment environment) {
final String template = configuration.getTemplate();
final String defaultName = configuration.getDefaultName();
ExecutorService es = environment.managedExecutorService("test-thread-%d", 10, 20, 10, TimeUnit.SECONDS);
environment.addResource(new TestResource(template, defaultName));
environment.addHealthCheck(new TemplateHealthCheck(template));
es.execute(new Runnable() {
public void run() {
System.out.println("hello world from a thread");
}
});
}
Or is it better to use the Managed approach:
environment.manage(managedTcpServer);
and have the server implement it's logic in start()/ stop().
Or finally, it seems like one could implement a Command, similar to the server command, in fact just add another "tcpServer.start()" to the ServerCommand#run() method?
It's not clear to me exactly which approach is most in keeping with the framework and will best allow full use of the healthchecks and metrics etc? Seems to me implementing in Service#initialize() may be the best way?