();
for (int i = 0; i < components.length; i++) {
final Component c = components[i];
final ActiveObjectProxy activeObjectProxy = new ActiveObjectProxy(c.intf(), c.target(), c.timeout());
workers.add(c.newWorker(activeObjectProxy));
activeObjectRegistry.put(c.intf(), activeObjectProxy);
}
supervisor = activeObjectFactory.supervise(restartStrategy.transform(), workers);
return this;
}
/**
* Add additional services to be wired in.
*
* ActiveObjectGuiceConfigurator.addExternalGuiceModule(new AbstractModule {
* protected void configure() {
* bind(Foo.class).to(FooImpl.class).in(Scopes.SINGLETON);
* bind(BarImpl.class);
* link(Bar.class).to(BarImpl.class);
* bindConstant(named("port")).to(8080);
* }})
*
*/
public synchronized ActiveObjectGuiceConfigurator addExternalGuiceModule(Module module) {
modules.add(module);
return this;
}
public List getGuiceModules() {
return modules;
}
public synchronized void reset() {
modules = new ArrayList();
configRegistry = new HashMap();
activeObjectRegistry = new HashMap();
injector = null;
restartStrategy = null;
}
public synchronized void stop() {
supervisor.stop();
}
}