本文整理汇总了Java中org.apache.hadoop.hbase.rest.model.VersionModel.getObjectFromMessage方法的典型用法代码示例。如果您正苦于以下问题:Java VersionModel.getObjectFromMessage方法的具体用法?Java VersionModel.getObjectFromMessage怎么用?Java VersionModel.getObjectFromMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hbase.rest.model.VersionModel
的用法示例。
在下文中一共展示了VersionModel.getObjectFromMessage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRestVersion
import org.apache.hadoop.hbase.rest.model.VersionModel; //导入方法依赖的package包/类
/**
* @return string representing the rest api's version
* @throws IOException
* if the endpoint does not exist, there is a timeout, or some other
* general failure mode
*/
public VersionModel getRestVersion() throws IOException {
StringBuilder path = new StringBuilder();
path.append('/');
if (accessToken != null) {
path.append(accessToken);
path.append('/');
}
path.append("version/rest");
int code = 0;
for (int i = 0; i < maxRetries; i++) {
Response response = client.get(path.toString(),
Constants.MIMETYPE_PROTOBUF);
code = response.getCode();
switch (code) {
case 200:
VersionModel v = new VersionModel();
return (VersionModel) v.getObjectFromMessage(response.getBody());
case 404:
throw new IOException("REST version not found");
case 509:
try {
Thread.sleep(sleepTime);
} catch (InterruptedException e) {
throw (InterruptedIOException)new InterruptedIOException().initCause(e);
}
break;
default:
throw new IOException("get request to " + path.toString()
+ " returned " + code);
}
}
throw new IOException("get request to " + path.toString() + " timed out");
}
示例2: getRestVersion
import org.apache.hadoop.hbase.rest.model.VersionModel; //导入方法依赖的package包/类
/**
* @return string representing the rest api's version
* @throws IOEXception
* if the endpoint does not exist, there is a timeout, or some other
* general failure mode
*/
public VersionModel getRestVersion() throws IOException {
StringBuilder path = new StringBuilder();
path.append('/');
if (accessToken != null) {
path.append(accessToken);
path.append('/');
}
path.append("version/rest");
int code = 0;
for (int i = 0; i < maxRetries; i++) {
Response response = client.get(path.toString(),
Constants.MIMETYPE_PROTOBUF);
code = response.getCode();
switch (code) {
case 200:
VersionModel v = new VersionModel();
return (VersionModel) v.getObjectFromMessage(response.getBody());
case 404:
throw new IOException("REST version not found");
case 509:
try {
Thread.sleep(sleepTime);
} catch (InterruptedException e) {
}
break;
default:
throw new IOException("get request to " + path.toString()
+ " returned " + code);
}
}
throw new IOException("get request to " + path.toString() + " timed out");
}
示例3: getRestVersion
import org.apache.hadoop.hbase.rest.model.VersionModel; //导入方法依赖的package包/类
/**
* @return string representing the rest api's version
* @throws IOEXception
* if the endpoint does not exist, there is a timeout, or some other
* general failure mode
*/
public VersionModel getRestVersion() throws IOException {
StringBuilder path = new StringBuilder();
path.append('/');
if (accessToken != null) {
path.append(accessToken);
path.append('/');
}
path.append("version/rest");
int code = 0;
for (int i = 0; i < maxRetries; i++) {
Response response = client.get(path.toString(),
Constants.MIMETYPE_PROTOBUF);
code = response.getCode();
switch (code) {
case 200:
VersionModel v = new VersionModel();
return (VersionModel) v.getObjectFromMessage(response.getBody());
case 404:
throw new IOException("REST version not found");
case 509:
try {
Thread.sleep(sleepTime);
} catch (InterruptedException e) {
throw (InterruptedIOException)new InterruptedIOException().initCause(e);
}
break;
default:
throw new IOException("get request to " + path.toString()
+ " returned " + code);
}
}
throw new IOException("get request to " + path.toString() + " timed out");
}