use of io.cdap.cdap.api.service.Service in project cdap by cdapio.
the class ServiceHttpServer method initializeService.
@Override
protected void initializeService() throws Exception {
super.initializeService();
// Instantiate service instance
Class<?> serviceClass = program.getClassLoader().loadClass(serviceSpecification.getClassName());
@SuppressWarnings("unchecked") TypeToken<Service> serviceType = (TypeToken<Service>) TypeToken.of(serviceClass);
service = new InstantiatorFactory(false).get(serviceType).create();
// Initialize service
// Service is always using Explicit transaction
TransactionControl txControl = Transactions.getTransactionControl(TransactionControl.EXPLICIT, Service.class, service, "initialize", ServiceContext.class);
serviceContext.initializeProgram(service, txControl, false);
}
use of io.cdap.cdap.api.service.Service in project cdap by caskdata.
the class ServiceHttpServer method initializeService.
@Override
protected void initializeService() throws Exception {
super.initializeService();
// Instantiate service instance
Class<?> serviceClass = program.getClassLoader().loadClass(serviceSpecification.getClassName());
@SuppressWarnings("unchecked") TypeToken<Service> serviceType = (TypeToken<Service>) TypeToken.of(serviceClass);
service = new InstantiatorFactory(false).get(serviceType).create();
// Initialize service
// Service is always using Explicit transaction
TransactionControl txControl = Transactions.getTransactionControl(TransactionControl.EXPLICIT, Service.class, service, "initialize", ServiceContext.class);
serviceContext.initializeProgram(service, txControl, false);
}
Aggregations