當前位置: 首頁>>代碼示例>>Java>>正文


Java NodeHotThreads類代碼示例

本文整理匯總了Java中org.elasticsearch.action.admin.cluster.node.hotthreads.NodeHotThreads的典型用法代碼示例。如果您正苦於以下問題:Java NodeHotThreads類的具體用法?Java NodeHotThreads怎麽用?Java NodeHotThreads使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


NodeHotThreads類屬於org.elasticsearch.action.admin.cluster.node.hotthreads包,在下文中一共展示了NodeHotThreads類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: prepareRequest

import org.elasticsearch.action.admin.cluster.node.hotthreads.NodeHotThreads; //導入依賴的package包/類
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
    String[] nodesIds = Strings.splitStringByCommaToArray(request.param("nodeId"));
    NodesHotThreadsRequest nodesHotThreadsRequest = new NodesHotThreadsRequest(nodesIds);
    nodesHotThreadsRequest.threads(request.paramAsInt("threads", nodesHotThreadsRequest.threads()));
    nodesHotThreadsRequest.ignoreIdleThreads(request.paramAsBoolean("ignore_idle_threads", nodesHotThreadsRequest.ignoreIdleThreads()));
    nodesHotThreadsRequest.type(request.param("type", nodesHotThreadsRequest.type()));
    nodesHotThreadsRequest.interval(TimeValue.parseTimeValue(request.param("interval"), nodesHotThreadsRequest.interval(), "interval"));
    nodesHotThreadsRequest.snapshots(request.paramAsInt("snapshots", nodesHotThreadsRequest.snapshots()));
    nodesHotThreadsRequest.timeout(request.param("timeout"));
    return channel -> client.admin().cluster().nodesHotThreads(
            nodesHotThreadsRequest,
            new RestResponseListener<NodesHotThreadsResponse>(channel) {
                @Override
                public RestResponse buildResponse(NodesHotThreadsResponse response) throws Exception {
                    StringBuilder sb = new StringBuilder();
                    for (NodeHotThreads node : response.getNodes()) {
                        sb.append("::: ").append(node.getNode().toString()).append("\n");
                        Strings.spaceify(3, node.getHotThreads(), sb);
                        sb.append('\n');
                    }
                    return new BytesRestResponse(RestStatus.OK, sb.toString());
                }
            });
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:26,代碼來源:RestNodesHotThreadsAction.java

示例2: handleRequest

import org.elasticsearch.action.admin.cluster.node.hotthreads.NodeHotThreads; //導入依賴的package包/類
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
    String[] nodesIds = Strings.splitStringByCommaToArray(request.param("nodeId"));
    NodesHotThreadsRequest nodesHotThreadsRequest = new NodesHotThreadsRequest(nodesIds);
    nodesHotThreadsRequest.threads(request.paramAsInt("threads", nodesHotThreadsRequest.threads()));
    nodesHotThreadsRequest.ignoreIdleThreads(request.paramAsBoolean("ignore_idle_threads", nodesHotThreadsRequest.ignoreIdleThreads()));
    nodesHotThreadsRequest.type(request.param("type", nodesHotThreadsRequest.type()));
    nodesHotThreadsRequest.interval(TimeValue.parseTimeValue(request.param("interval"), nodesHotThreadsRequest.interval(), "interval"));
    nodesHotThreadsRequest.snapshots(request.paramAsInt("snapshots", nodesHotThreadsRequest.snapshots()));
    nodesHotThreadsRequest.timeout(request.param("timeout"));
    client.admin().cluster().nodesHotThreads(nodesHotThreadsRequest, new RestResponseListener<NodesHotThreadsResponse>(channel) {
        @Override
        public RestResponse buildResponse(NodesHotThreadsResponse response) throws Exception {
            StringBuilder sb = new StringBuilder();
            for (NodeHotThreads node : response) {
                sb.append("::: ").append(node.getNode().toString()).append("\n");
                Strings.spaceify(3, node.getHotThreads(), sb);
                sb.append('\n');
            }
            return new BytesRestResponse(RestStatus.OK, sb.toString());
        }
    });
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:24,代碼來源:RestNodesHotThreadsAction.java

示例3: responseToOutput

import org.elasticsearch.action.admin.cluster.node.hotthreads.NodeHotThreads; //導入依賴的package包/類
@Override
protected String responseToOutput(NodesHotThreadsRequest request, NodesHotThreadsResponse response) {
    StringBuilder sb = new StringBuilder();
    try {
        for (NodeHotThreads node : response) {
            sb.append("::: ").append(node.getNode().toString()).append("\n");
            Strings.spaceify(3, node.getHotThreads(), sb);
            sb.append('\n');
        }
    } catch(Exception e) {
        logger.error("Error while generating the nodes hot thread output", e);
    }
    return sb.toString();
}
 
開發者ID:javanna,項目名稱:elasticshell,代碼行數:15,代碼來源:NodesHotThreadsRequestBuilder.java


注:本文中的org.elasticsearch.action.admin.cluster.node.hotthreads.NodeHotThreads類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。