本文整理汇总了Java中org.apache.mesos.v1.scheduler.V0Mesos类的典型用法代码示例。如果您正苦于以下问题:Java V0Mesos类的具体用法?Java V0Mesos怎么用?Java V0Mesos使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
V0Mesos类属于org.apache.mesos.v1.scheduler包,在下文中一共展示了V0Mesos类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startInternal
import org.apache.mesos.v1.scheduler.V0Mesos; //导入依赖的package包/类
/**
* Broken out into a separate function to allow testing with custom `Mesos` implementations.
*/
@VisibleForTesting
protected Mesos startInternal() {
String version = System.getenv("MESOS_API_VERSION");
if (version == null) {
version = "V0";
}
LOGGER.info("Using Mesos API version: {}", version);
if (version.equals("V0")) {
if (credential == null) {
return new V0Mesos(this, frameworkInfo, master);
} else {
return new V0Mesos(this, frameworkInfo, master, credential);
}
} else if (version.equals("V1")) {
if (credential == null) {
return new V1Mesos(this, master);
} else {
return new V1Mesos(this, master, credential);
}
} else {
throw new IllegalArgumentException("Unsupported API version: " + version);
}
}
示例2: createInternal
import org.apache.mesos.v1.scheduler.V0Mesos; //导入依赖的package包/类
/**
* Broken out into a separate function to allow testing with custom SchedulerDrivers.
*/
protected SchedulerDriver createInternal(
final Scheduler scheduler,
final FrameworkInfo frameworkInfo,
final String masterUrl,
final Credential credential,
final String mesosAPIVersion) {
Capabilities capabilities = Capabilities.getInstance();
if (credential != null) {
return new MesosToSchedulerDriverAdapter(scheduler, frameworkInfo, masterUrl, true, credential) {
@Override
protected Mesos startInternal() {
if (capabilities.supportsV1APIByDefault()) {
return super.startInternal();
}
if (mesosAPIVersion.equals("V1")) {
LOGGER.warn(
"Current DC/OS cluster doesn't support the Mesos V1 API in strict mode. Using V0...");
}
return new V0Mesos(
this,
EvolverDevolver.evolve(frameworkInfo),
masterUrl,
EvolverDevolver.evolve(credential));
}
};
}
// Love too work around the fact that the MesosToSchedulerDriverAdapter both depends directly on the
// process environment *and* uses two unrelated constructors for the case of credential being null
return new MesosToSchedulerDriverAdapter(scheduler, frameworkInfo, masterUrl, true) {
@Override
protected Mesos startInternal() {
if (capabilities.supportsV1APIByDefault()) {
return super.startInternal();
}
if (mesosAPIVersion.equals("V1")) {
LOGGER.warn(
"Current DC/OS cluster doesn't support the Mesos V1 API in strict mode. Using V0...");
}
return new V0Mesos(this, EvolverDevolver.evolve(frameworkInfo), masterUrl);
}
};
}