use of com.yahoo.jdisc.service.ServerProvider in project vespa by vespa-engine.
the class ConfiguredApplication method startAndStopServers.
private static void startAndStopServers() {
List<ServerProvider> currentServers = Container.get().getServerProviderRegistry().allComponents();
HashSet<ServerProvider> serversToClose = new HashSet<>(startedServers);
serversToClose.removeAll(currentServers);
for (ServerProvider server : serversToClose) {
closeServer(server);
}
for (ServerProvider server : currentServers) {
if (!startedServers.contains(server)) {
server.start();
startedServers.add(server);
}
}
}
use of com.yahoo.jdisc.service.ServerProvider in project vespa by vespa-engine.
the class ConfiguredApplication method stop.
@Override
public void stop() {
startShutdownDeadlineExecutor();
shutdownReconfigurerThread();
configurer.shutdown(new Deconstructor(false));
for (ServerProvider server : Container.get().getServerProviderRegistry().allComponents()) {
if (startedServers.contains(server)) {
closeServer(server);
}
}
Container.get().shutdown();
}
use of com.yahoo.jdisc.service.ServerProvider in project vespa by vespa-engine.
the class ServerRepository method install.
public ServerProvider install(Bundle bundle, String serverName) throws ClassNotFoundException {
log.finer("Installing server provider '" + serverName + "'.");
Class<?> namedClass = bundle.loadClass(serverName);
Class<ServerProvider> serverClass = ContainerBuilder.safeClassCast(ServerProvider.class, namedClass);
ServerProvider server = guice.getInstance(serverClass);
install(server);
return server;
}
use of com.yahoo.jdisc.service.ServerProvider in project vespa by vespa-engine.
the class ActiveContainerTestCase method requireThatServerAccessorWorks.
@Test
public void requireThatServerAccessorWorks() {
TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi();
ContainerBuilder builder = driver.newContainerBuilder();
ServerProvider foo = new NonWorkingServerProvider();
builder.serverProviders().install(foo);
ServerProvider bar = new NonWorkingServerProvider();
builder.serverProviders().install(bar);
ActiveContainer container = new ActiveContainer(builder);
Iterator<ServerProvider> it = container.serverProviders().iterator();
assertTrue(it.hasNext());
assertSame(foo, it.next());
assertTrue(it.hasNext());
assertSame(bar, it.next());
assertFalse(it.hasNext());
driver.close();
}
use of com.yahoo.jdisc.service.ServerProvider in project vespa by vespa-engine.
the class ServerRepositoryTestCase method requireThatUninstallAllWorks.
@Test
public void requireThatUninstallAllWorks() {
ServerRepository servers = newServerRepository();
ServerProvider foo = new MyServer();
ServerProvider bar = new MyServer();
ServerProvider baz = new MyServer();
servers.installAll(Arrays.asList(foo, bar, baz));
servers.uninstallAll(Arrays.asList(foo, bar));
Iterator<ServerProvider> it = servers.iterator();
assertNotNull(it);
assertTrue(it.hasNext());
assertSame(baz, it.next());
assertFalse(it.hasNext());
}
Aggregations