本文整理汇总了Java中org.apache.mesos.Protos.FrameworkID.parseFrom方法的典型用法代码示例。如果您正苦于以下问题:Java FrameworkID.parseFrom方法的具体用法?Java FrameworkID.parseFrom怎么用?Java FrameworkID.parseFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.mesos.Protos.FrameworkID
的用法示例。
在下文中一共展示了FrameworkID.parseFrom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFrameworkId
import org.apache.mesos.Protos.FrameworkID; //导入方法依赖的package包/类
/**
* Returns the Framework ID stored in the Zookeeper state.
*
* @return the Framework ID stored in the Zookeeper state. Null if no Framework ID was found.
*/
public FrameworkID getFrameworkId() {
try {
byte[] existingFrameworkId = state.fetch("frameworkId").get().value();
if (existingFrameworkId.length > 0) {
FrameworkID frameworkId = FrameworkID.parseFrom(existingFrameworkId);
LOGGER.info("Found FrameworkID " + frameworkId.getValue());
return frameworkId;
} else {
LOGGER.info("No existing FrameworkID found");
return null;
}
} catch (InterruptedException | ExecutionException | InvalidProtocolBufferException e) {
LOGGER.error("Failed to get framework ID from Zookeeper state", e);
throw new RuntimeException("Failed to get framework ID from Zookeeper state", e);
}
}
示例2: getFrameworkID
import org.apache.mesos.Protos.FrameworkID; //导入方法依赖的package包/类
@Override public FrameworkID getFrameworkID() throws InterruptedException, ExecutionException, InvalidProtocolBufferException {
byte[] existingFrameworkId = zkState.fetch(FRAMEWORK_ID_KEY).get().value();
if (existingFrameworkId.length > 0) {
return FrameworkID.parseFrom(existingFrameworkId);
} else {
return null;
}
}