AbstractDriverV1.java 文件源码

java
阅读 33 收藏 0 点赞 0 评论 0

项目:java-mesos-util 作者:
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);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号