use of com.google.common.util.concurrent.Service in project cdap by caskdata.
the class MetricsTestBase method init.
@Before
public void init() throws IOException, UnsupportedTypeException {
cConf = CConfiguration.create();
cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder().getAbsolutePath());
injector = Guice.createInjector(getModules());
messagingService = injector.getInstance(MessagingService.class);
if (messagingService instanceof Service) {
((Service) messagingService).startAndWait();
}
metricValueType = TypeToken.of(MetricValues.class);
schema = new ReflectionSchemaGenerator().generate(metricValueType.getType());
recordWriter = new ASMDatumWriterFactory(new ASMFieldAccessorFactory()).create(metricValueType, schema);
}
use of com.google.common.util.concurrent.Service in project cdap by caskdata.
the class MessagingServiceTwillRunnable method addServices.
@Override
protected void addServices(List<? super Service> services) {
MessagingService messagingService = injector.getInstance(MessagingService.class);
if (messagingService instanceof Service) {
services.add((Service) messagingService);
}
services.add(injector.getInstance(MessagingHttpService.class));
}
use of com.google.common.util.concurrent.Service in project cdap by caskdata.
the class StandaloneMain method startUp.
/**
* Start the service.
*/
public void startUp() throws Exception {
// Workaround for release of file descriptors opened by URLClassLoader - https://issues.cask.co/browse/CDAP-2841
URLConnections.setDefaultUseCaches(false);
cleanupTempDir();
ConfigurationLogger.logImportantConfig(cConf);
if (messagingService instanceof Service) {
((Service) messagingService).startAndWait();
}
// TODO: CDAP-7688, remove next line after the issue is resolved
injector.getInstance(MessagingHttpService.class).startAndWait();
// Authorization bootstrapping is a blocking call, because CDAP will not start successfully if it does not
// succeed on an authorization-enabled cluster
authorizationBootstrapper.run();
txService.startAndWait();
metricsCollectionService.startAndWait();
datasetService.startAndWait();
serviceStore.startAndWait();
streamService.startAndWait();
// Validate the logging pipeline configuration.
// Do it explicitly as Standalone doesn't have a separate master check phase as the distributed does.
new LogPipelineLoader(cConf).validate();
// It is recommended to initialize log appender after datasetService is started,
// since log appender instantiates a dataset.
logAppenderInitializer.initialize();
Service.State state = appFabricServer.startAndWait();
if (state != Service.State.RUNNING) {
throw new Exception("Failed to start Application Fabric");
}
metricsQueryService.startAndWait();
router.startAndWait();
if (userInterfaceService != null) {
userInterfaceService.startAndWait();
}
if (securityEnabled) {
externalAuthenticationServer.startAndWait();
}
if (exploreExecutorService != null) {
exploreExecutorService.startAndWait();
}
metadataService.startAndWait();
if (trackerAppCreationService != null) {
trackerAppCreationService.startAndWait();
}
wranglerAppCreationService.startAndWait();
remoteSystemOperationsService.startAndWait();
operationalStatsService.startAndWait();
String protocol = sslEnabled ? "https" : "http";
int dashboardPort = sslEnabled ? cConf.getInt(Constants.Dashboard.SSL_BIND_PORT) : cConf.getInt(Constants.Dashboard.BIND_PORT);
System.out.println("CDAP Sandbox started successfully.");
System.out.printf("Connect to the CDAP UI at %s://%s:%d\n", protocol, "localhost", dashboardPort);
}
Aggregations