本文整理汇总了Java中org.apache.twill.api.TwillApplication类的典型用法代码示例。如果您正苦于以下问题:Java TwillApplication类的具体用法?Java TwillApplication怎么用?Java TwillApplication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TwillApplication类属于org.apache.twill.api包,在下文中一共展示了TwillApplication类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepare
import org.apache.twill.api.TwillApplication; //导入依赖的package包/类
@Override
public TwillPreparer prepare(TwillApplication application) {
Preconditions.checkState(isRunning(), "Service not start. Please call start() first.");
final TwillSpecification twillSpec = application.configure();
final String appName = twillSpec.getName();
return new YarnTwillPreparer(yarnConfig, twillSpec, yarnAppClient, zkClientService, locationFactory, jvmOptions,
new YarnTwillControllerFactory() {
@Override
public YarnTwillController create(RunId runId, Iterable<LogHandler> logHandlers,
Callable<ProcessController<YarnApplicationReport>> startUp) {
ZKClient zkClient = ZKClients.namespace(zkClientService, "/" + appName);
YarnTwillController controller = listenController(new YarnTwillController(appName, runId, zkClient,
logHandlers, startUp));
synchronized (YarnTwillRunnerService.this) {
Preconditions.checkArgument(!controllers.contains(appName, runId),
"Application %s with runId %s is already running.", appName, runId);
controllers.put(appName, runId, controller);
}
return controller;
}
});
}