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


Java FlushRequest.waitIfOngoing方法代碼示例

本文整理匯總了Java中org.elasticsearch.action.admin.indices.flush.FlushRequest.waitIfOngoing方法的典型用法代碼示例。如果您正苦於以下問題:Java FlushRequest.waitIfOngoing方法的具體用法?Java FlushRequest.waitIfOngoing怎麽用?Java FlushRequest.waitIfOngoing使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.elasticsearch.action.admin.indices.flush.FlushRequest的用法示例。


在下文中一共展示了FlushRequest.waitIfOngoing方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleRequest

import org.elasticsearch.action.admin.indices.flush.FlushRequest; //導入方法依賴的package包/類
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
    FlushRequest flushRequest = new FlushRequest(Strings.splitStringByCommaToArray(request.param("index")));
    flushRequest.indicesOptions(IndicesOptions.fromRequest(request, flushRequest.indicesOptions()));
    flushRequest.force(request.paramAsBoolean("force", flushRequest.force()));
    flushRequest.waitIfOngoing(request.paramAsBoolean("wait_if_ongoing", flushRequest.waitIfOngoing()));
    client.admin().indices().flush(flushRequest, new RestBuilderListener<FlushResponse>(channel) {
        @Override
        public RestResponse buildResponse(FlushResponse response, XContentBuilder builder) throws Exception {
            builder.startObject();
            buildBroadcastShardsHeader(builder, request, response);
            builder.endObject();
            return new BytesRestResponse(OK, builder);
        }
    });
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:17,代碼來源:RestFlushAction.java

示例2: flush

import org.elasticsearch.action.admin.indices.flush.FlushRequest; //導入方法依賴的package包/類
public Engine.CommitId flush(FlushRequest request) throws ElasticsearchException {
    boolean waitIfOngoing = request.waitIfOngoing();
    boolean force = request.force();
    if (logger.isTraceEnabled()) {
        logger.trace("flush with {}", request);
    }
    // we allows flush while recovering, since we allow for operations to happen
    // while recovering, and we want to keep the translog at bay (up to deletes, which
    // we don't gc). Yet, we don't use flush internally to clear deletes and flush the indexwriter since
    // we use #writeIndexingBuffer for this now.
    verifyNotClosed();
    Engine engine = getEngine();
    if (engine.isRecovering()) {
        throw new IllegalIndexShardStateException(shardId(), state, "flush is only allowed if the engine is not recovery" +
            " from translog");
    }
    long time = System.nanoTime();
    Engine.CommitId commitId = engine.flush(force, waitIfOngoing);
    flushMetric.inc(System.nanoTime() - time);
    return commitId;

}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:23,代碼來源:IndexShard.java

示例3: prepareRequest

import org.elasticsearch.action.admin.indices.flush.FlushRequest; //導入方法依賴的package包/類
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
    FlushRequest flushRequest = new FlushRequest(Strings.splitStringByCommaToArray(request.param("index")));
    flushRequest.indicesOptions(IndicesOptions.fromRequest(request, flushRequest.indicesOptions()));
    flushRequest.force(request.paramAsBoolean("force", flushRequest.force()));
    flushRequest.waitIfOngoing(request.paramAsBoolean("wait_if_ongoing", flushRequest.waitIfOngoing()));
    return channel -> client.admin().indices().flush(flushRequest, new RestBuilderListener<FlushResponse>(channel) {
        @Override
        public RestResponse buildResponse(FlushResponse response, XContentBuilder builder) throws Exception {
            builder.startObject();
            buildBroadcastShardsHeader(builder, request, response);
            builder.endObject();
            return new BytesRestResponse(OK, builder);
        }
    });
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:17,代碼來源:RestFlushAction.java

示例4: flush

import org.elasticsearch.action.admin.indices.flush.FlushRequest; //導入方法依賴的package包/類
public Engine.CommitId flush(FlushRequest request) throws ElasticsearchException {
    boolean waitIfOngoing = request.waitIfOngoing();
    boolean force = request.force();
    if (logger.isTraceEnabled()) {
        logger.trace("flush with {}", request);
    }
    // we allows flush while recovering, since we allow for operations to happen
    // while recovering, and we want to keep the translog at bay (up to deletes, which
    // we don't gc).
    verifyStartedOrRecovering();

    long time = System.nanoTime();
    Engine.CommitId commitId = engine().flush(force, waitIfOngoing);
    flushMetric.inc(System.nanoTime() - time);
    return commitId;

}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:18,代碼來源:IndexShard.java


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