本文整理汇总了Java中org.apache.mesos.Protos.Offer.getResourcesList方法的典型用法代码示例。如果您正苦于以下问题:Java Offer.getResourcesList方法的具体用法?Java Offer.getResourcesList怎么用?Java Offer.getResourcesList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.mesos.Protos.Offer
的用法示例。
在下文中一共展示了Offer.getResourcesList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPersistentVolumesById
import org.apache.mesos.Protos.Offer; //导入方法依赖的package包/类
/**
* Returns an ID -> Resource mapping of all disk resources listed in the provided {@link Offer},
* or an empty list of no disk resources are found.
* @param offer The Offer being deconstructed.
* @return The map of resources from the {@link Offer}
*/
private static Map<String, Resource> getPersistentVolumesById(Offer offer) {
Map<String, Resource> volumes = new HashMap<>();
for (Resource resource : offer.getResourcesList()) {
if (resource.hasDisk() && resource.getDisk().hasPersistence()) {
volumes.put(resource.getDisk().getPersistence().getId(), resource);
}
}
return volumes;
}
示例2: getReservedResourcesById
import org.apache.mesos.Protos.Offer; //导入方法依赖的package包/类
/**
* Returns an ID -> Resource mapping of all reservation resources listed in the provided
* {@link Offer}, or an empty list if no reservation resources are found.
*/
private static Map<String, Resource> getReservedResourcesById(Offer offer) {
Map<String, Resource> reservedResources = new HashMap<>();
for (Resource resource : offer.getResourcesList()) {
Optional<String> resourceId = ResourceUtils.getResourceId(resource);
if (resourceId.isPresent()) {
reservedResources.put(resourceId.get(), resource);
}
}
return reservedResources;
}
示例3: getMesosResources
import org.apache.mesos.Protos.Offer; //导入方法依赖的package包/类
private static Collection<MesosResource> getMesosResources(Offer offer, Optional<String> role) {
Collection<MesosResource> mesosResources = new ArrayList<MesosResource>();
for (Resource resource : offer.getResourcesList()) {
if (consumableResource(role, resource)) {
mesosResources.add(new MesosResource(resource));
}
}
return mesosResources;
}