use of io.airlift.json.JsonModule in project presto by prestodb.
the class PrestoServer method run.
@Override
public void run() {
verifyJvmRequirements();
verifySystemTimeIsReasonable();
Logger log = Logger.get(PrestoServer.class);
ImmutableList.Builder<Module> modules = ImmutableList.builder();
modules.add(new NodeModule(), new DiscoveryModule(), new HttpServerModule(), new JsonModule(), new JaxrsModule(true), new MBeanModule(), new JmxModule(), new JmxHttpModule(), new LogJmxModule(), new TraceTokenModule(), new JsonEventModule(), new HttpEventModule(), new EmbeddedDiscoveryModule(), new ServerSecurityModule(), new AccessControlModule(), new EventListenerModule(), new ServerMainModule(sqlParserOptions), new GracefulShutdownModule());
modules.addAll(getAdditionalModules());
Bootstrap app = new Bootstrap(modules.build());
try {
Injector injector = app.strictConfig().initialize();
injector.getInstance(PluginManager.class).loadPlugins();
injector.getInstance(StaticCatalogStore.class).loadCatalogs();
// TODO: remove this huge hack
updateConnectorIds(injector.getInstance(Announcer.class), injector.getInstance(CatalogManager.class), injector.getInstance(ServerConfig.class), injector.getInstance(NodeSchedulerConfig.class));
injector.getInstance(ResourceGroupManager.class).loadConfigurationManager();
injector.getInstance(AccessControlManager.class).loadSystemAccessControl();
injector.getInstance(EventListenerManager.class).loadConfiguredEventListener();
injector.getInstance(Announcer.class).start();
log.info("======== SERVER STARTED ========");
} catch (Throwable e) {
log.error(e);
System.exit(1);
}
}
use of io.airlift.json.JsonModule in project presto by prestodb.
the class TestInformationSchemaTableHandle method startUp.
@BeforeMethod
public void startUp() {
Injector injector = Guice.createInjector(new JsonModule(), new HandleJsonModule());
objectMapper = injector.getInstance(ObjectMapper.class);
}
use of io.airlift.json.JsonModule in project presto by prestodb.
the class TestHeartbeatFailureDetector method testExcludesCurrentNode.
@Test
public void testExcludesCurrentNode() throws Exception {
Bootstrap app = new Bootstrap(new TestingNodeModule(), new TestingJmxModule(), new TestingDiscoveryModule(), new TestingHttpServerModule(), new TraceTokenModule(), new JsonModule(), new JaxrsModule(true), new FailureDetectorModule(), new Module() {
@Override
public void configure(Binder binder) {
configBinder(binder).bindConfig(QueryManagerConfig.class);
discoveryBinder(binder).bindSelector("presto");
discoveryBinder(binder).bindHttpAnnouncement("presto");
// Jersey with jetty 9 requires at least one resource
// todo add a dummy resource to airlift jaxrs in this case
jaxrsBinder(binder).bind(FooResource.class);
}
});
Injector injector = app.strictConfig().doNotInitializeLogging().initialize();
ServiceSelector selector = injector.getInstance(Key.get(ServiceSelector.class, serviceType("presto")));
assertEquals(selector.selectAllServices().size(), 1);
HeartbeatFailureDetector detector = injector.getInstance(HeartbeatFailureDetector.class);
detector.updateMonitoredServices();
assertEquals(detector.getTotalCount(), 0);
assertEquals(detector.getActiveCount(), 0);
assertEquals(detector.getFailedCount(), 0);
assertTrue(detector.getFailed().isEmpty());
}
use of io.airlift.json.JsonModule in project presto by prestodb.
the class TestSystemTableHandle method startUp.
@BeforeMethod
public void startUp() {
Injector injector = Guice.createInjector(new JsonModule(), new HandleJsonModule());
objectMapper = injector.getInstance(ObjectMapper.class);
}
use of io.airlift.json.JsonModule in project presto by prestodb.
the class CassandraConnectorFactory method create.
@Override
public Connector create(String connectorId, Map<String, String> config, ConnectorContext context) {
requireNonNull(config, "config is null");
try {
Bootstrap app = new Bootstrap(new MBeanModule(), new JsonModule(), new CassandraClientModule(connectorId), new Module() {
@Override
public void configure(Binder binder) {
MBeanServer platformMBeanServer = ManagementFactory.getPlatformMBeanServer();
binder.bind(MBeanServer.class).toInstance(new RebindSafeMBeanServer(platformMBeanServer));
}
});
Injector injector = app.strictConfig().doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
return injector.getInstance(CassandraConnector.class);
} catch (Exception e) {
throw Throwables.propagate(e);
}
}
Aggregations