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