本文整理汇总了Java中org.apache.hadoop.hbase.util.VersionInfo.getVersion方法的典型用法代码示例。如果您正苦于以下问题:Java VersionInfo.getVersion方法的具体用法?Java VersionInfo.getVersion怎么用?Java VersionInfo.getVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hbase.util.VersionInfo
的用法示例。
在下文中一共展示了VersionInfo.getVersion方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getVersionInfo
import org.apache.hadoop.hbase.util.VersionInfo; //导入方法依赖的package包/类
/**
* Get a protocol buffer VersionInfo
*
* @return the converted protocol buffer VersionInfo
*/
public static HBaseProtos.VersionInfo getVersionInfo() {
HBaseProtos.VersionInfo.Builder builder = HBaseProtos.VersionInfo.newBuilder();
String version = VersionInfo.getVersion();
builder.setVersion(version);
String[] components = version.split("\\.");
if (components != null && components.length > 2) {
builder.setVersionMajor(Integer.parseInt(components[0]));
builder.setVersionMinor(Integer.parseInt(components[1]));
}
builder.setUrl(VersionInfo.getUrl());
builder.setRevision(VersionInfo.getRevision());
builder.setUser(VersionInfo.getUser());
builder.setDate(VersionInfo.getDate());
builder.setSrcChecksum(VersionInfo.getSrcChecksum());
return builder.build();
}
示例2: getClusterStatus
import org.apache.hadoop.hbase.util.VersionInfo; //导入方法依赖的package包/类
/**
* @return cluster status
*/
public ClusterStatus getClusterStatus() {
// Build Set of backup masters from ZK nodes
List<String> backupMasterStrings;
try {
backupMasterStrings = ZKUtil.listChildrenNoWatch(this.zooKeeper,
this.zooKeeper.backupMasterAddressesZNode);
} catch (KeeperException e) {
LOG.warn(this.zooKeeper.prefix("Unable to list backup servers"), e);
backupMasterStrings = new ArrayList<String>(0);
}
List<ServerName> backupMasters = new ArrayList<ServerName>(
backupMasterStrings.size());
for (String s: backupMasterStrings) {
backupMasters.add(new ServerName(s));
}
return new ClusterStatus(VersionInfo.getVersion(),
this.fileSystemManager.getClusterId(),
this.serverManager.getOnlineServers(),
this.serverManager.getDeadServers(),
this.serverName,
backupMasters,
this.assignmentManager.getRegionsInTransition(),
this.getCoprocessors());
}
示例3: chore
import org.apache.hadoop.hbase.util.VersionInfo; //导入方法依赖的package包/类
@Override
protected void chore() {
if (!connected) {
return;
}
List<ServerName> sns = generateDeadServersListToSend();
if (sns.isEmpty()) {
// Nothing to send. Done.
return;
}
final long curTime = EnvironmentEdgeManager.currentTime();
if (lastMessageTime > curTime - messagePeriod) {
// We already sent something less than 10 second ago. Done.
return;
}
// Ok, we're going to send something then.
lastMessageTime = curTime;
// We're reusing an existing protobuf message, but we don't send everything.
// This could be extended in the future, for example if we want to send stuff like the
// hbase:meta server name.
ClusterStatus cs = new ClusterStatus(VersionInfo.getVersion(),
master.getMasterFileSystem().getClusterId().toString(),
null,
sns,
master.getServerName(),
null,
null,
null,
null);
publisher.publish(cs);
}
示例4: checkDefaultsVersion
import org.apache.hadoop.hbase.util.VersionInfo; //导入方法依赖的package包/类
private static void checkDefaultsVersion(Configuration conf) {
if (conf.getBoolean("hbase.defaults.for.version.skip", Boolean.FALSE)) return;
String defaultsVersion = conf.get("hbase.defaults.for.version");
String thisVersion = VersionInfo.getVersion();
if (!thisVersion.equals(defaultsVersion)) {
throw new RuntimeException(
"hbase-default.xml file seems to be for an older version of HBase (" +
defaultsVersion + "), this version is " + thisVersion);
}
}
示例5: checkDefaultsVersion
import org.apache.hadoop.hbase.util.VersionInfo; //导入方法依赖的package包/类
private static void checkDefaultsVersion(Configuration conf) {
if (conf.getBoolean("hbase.defaults.for.version.skip", Boolean.FALSE)) return;
String defaultsVersion = conf.get("hbase.defaults.for.version");
String thisVersion = VersionInfo.getVersion();
// if (!thisVersion.equals(defaultsVersion)) {
// throw new RuntimeException(
// "hbase-default.xml file seems to be for and old version of HBase (" +
// defaultsVersion + "), this version is " + thisVersion);
// }
}
示例6: checkDefaultsVersion
import org.apache.hadoop.hbase.util.VersionInfo; //导入方法依赖的package包/类
private static void checkDefaultsVersion(Configuration conf) {
if (conf.getBoolean("hbase.defaults.for.version.skip", Boolean.FALSE)) return;
String defaultsVersion = conf.get("hbase.defaults.for.version");
String thisVersion = VersionInfo.getVersion();
if (!thisVersion.equals(defaultsVersion)) {
throw new RuntimeException(
"hbase-default.xml file seems to be for and old version of HBase (" +
defaultsVersion + "), this version is " + thisVersion);
}
}
示例7: chore
import org.apache.hadoop.hbase.util.VersionInfo; //导入方法依赖的package包/类
@Override
protected void chore() {
if (!connected) {
return;
}
List<ServerName> sns = generateDeadServersListToSend();
if (sns.isEmpty()) {
// Nothing to send. Done.
return;
}
final long curTime = EnvironmentEdgeManager.currentTimeMillis();
if (lastMessageTime > curTime - messagePeriod) {
// We already sent something less than 10 second ago. Done.
return;
}
// Ok, we're going to send something then.
lastMessageTime = curTime;
// We're reusing an existing protobuf message, but we don't send everything.
// This could be extended in the future, for example if we want to send stuff like the
// hbase:meta server name.
ClusterStatus cs = new ClusterStatus(VersionInfo.getVersion(),
master.getMasterFileSystem().getClusterId().toString(),
null,
sns,
master.getServerName(),
null,
null,
null,
null);
publisher.publish(cs);
}
示例8: checkDefaultsVersion
import org.apache.hadoop.hbase.util.VersionInfo; //导入方法依赖的package包/类
private static void checkDefaultsVersion(Configuration conf) {
if (conf.getBoolean("hbase.defaults.for.version.skip", Boolean.FALSE)) return;
String defaultsVersion = conf.get("hbase.defaults.for.version");
String thisVersion = VersionInfo.getVersion();
if (!thisVersion.equals(defaultsVersion)) {
throw new RuntimeException(
"hbase-default.xml file seems to be for and old version of HBase (" +
defaultsVersion + "), this version is " + thisVersion);
}
}
示例9: getHBaseVersion
import org.apache.hadoop.hbase.util.VersionInfo; //导入方法依赖的package包/类
/** @return the HBase release */
@Override
public String getHBaseVersion() {
return VersionInfo.getVersion();
}
示例10: getCompat
import org.apache.hadoop.hbase.util.VersionInfo; //导入方法依赖的package包/类
public synchronized static HBaseCompat getCompat(String classOverride) {
if (null != cachedCompat) {
log.debug("Returning cached HBase compatibility layer: {}", cachedCompat);
return cachedCompat;
}
HBaseCompat compat;
String className = null;
String classNameSource = null;
if (null != classOverride) {
className = classOverride;
classNameSource = "from explicit configuration";
} else {
String hbaseVersion = VersionInfo.getVersion();
for (String supportedVersion : Arrays.asList("0.94", "0.96", "0.98", "1.0", "1.1")) {
if (hbaseVersion.startsWith(supportedVersion + ".")) {
className = "com.thinkaurelius.titan.diskstorage.hbase.HBaseCompat" + supportedVersion.replaceAll("\\.", "_");
classNameSource = "supporting runtime HBase version " + hbaseVersion;
break;
}
}
if (null == className) {
log.info("The HBase version {} is not explicitly supported by Titan. " +
"Loading Titan's compatibility layer for its most recent supported HBase version ({})",
hbaseVersion, DEFAULT_HBASE_COMPAT_VERSION);
className = DEFAULT_HBASE_CLASS_NAME;
classNameSource = " by default";
}
}
final String errTemplate = " when instantiating HBase compatibility class " + className;
try {
compat = (HBaseCompat)Class.forName(className).newInstance();
log.info("Instantiated HBase compatibility layer {}: {}", classNameSource, compat.getClass().getCanonicalName());
} catch (IllegalAccessException | ClassNotFoundException | InstantiationException e) {
throw new RuntimeException(e.getClass().getSimpleName() + errTemplate, e);
}
return cachedCompat = compat;
}
示例11: version
import org.apache.hadoop.hbase.util.VersionInfo; //导入方法依赖的package包/类
/**
* get hbase version
*
* @return
*/
public static String version() {
return VersionInfo.getVersion();
}