protected void sendCall(GeneratedMessage call) {
try {
StringWriter body = new StringWriter();
new JsonFormat().print(call, body);
logger.debug("[call] " + body);
Request request = new Request(url)
.method(Request.Method.POST)
.contentType("application/json")
.accept("application/json")
.body(("" + body).getBytes("utf-8"));
if (streamId != null) // Mesos 0.25 has no streamId
request.header("Mesos-Stream-Id", streamId);
Request.Response response = request.send();
logger.debug("[response] " + response.code() + " - " + response.message() + (response.body() != null ? ": " + new String(response.body()) : ""));
if (response.code() != 202)
throw new DriverException("Response: " + response.code() + " - " + response.message() + (response.body() != null ? ": " + new String(response.body()) : ""));
} catch (IOException e) {
throw new DriverException(e);
}
}
AbstractDriverV1.java 文件源码
java
阅读 33
收藏 0
点赞 0
评论 0
项目:java-mesos-util
作者:
评论列表
文章目录