当前位置: 首页>>代码示例>>Java>>正文


Java EngineException类代码示例

本文整理汇总了Java中org.elasticsearch.index.engine.EngineException的典型用法代码示例。如果您正苦于以下问题:Java EngineException类的具体用法?Java EngineException怎么用?Java EngineException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EngineException类属于org.elasticsearch.index.engine包,在下文中一共展示了EngineException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ExtendedEngine

import org.elasticsearch.index.engine.EngineException; //导入依赖的package包/类
public ExtendedEngine(final EngineConfig engineConfig,
        final EngineFilters engineFilters) throws EngineException {
    super(engineConfig);
    engine = new InternalEngine(engineConfig);
    filters = engineFilters.filters();

    Class<? extends Engine> clazz = engine.getClass();
    try {
        getSearcherManagerMethod = clazz
                .getDeclaredMethod("getSearcherManager");
        getSearcherManagerMethod.setAccessible(true);
        closeNoLockMethod = clazz.getDeclaredMethod("closeNoLock",
                new Class<?>[] { String.class });
        closeNoLockMethod.setAccessible(true);
        getLastCommittedSegmentInfosMethod = clazz
                .getDeclaredMethod("getLastCommittedSegmentInfos");
        getLastCommittedSegmentInfosMethod.setAccessible(true);
    } catch (NoSuchMethodException | SecurityException e) {
        throw new EngineException(shardId,
                "Cannot load methods from " + clazz.getName(), e);
    }
}
 
开发者ID:codelibs,项目名称:elasticsearch-extension,代码行数:23,代码来源:ExtendedEngine.java

示例2: newSearcher

import org.elasticsearch.index.engine.EngineException; //导入依赖的package包/类
public AssertingIndexSearcher newSearcher(String source, IndexSearcher searcher, SearcherManager manager) throws EngineException {
    IndexReader reader = searcher.getIndexReader();
    IndexReader wrappedReader = reader;
    assert reader != null;
    if (reader instanceof DirectoryReader && mockContext.wrapReader) {
        wrappedReader = wrapReader((DirectoryReader) reader);
    }
    // this executes basic query checks and asserts that weights are normalized only once etc.
    final AssertingIndexSearcher assertingIndexSearcher = new AssertingIndexSearcher(mockContext.random, wrappedReader);
    assertingIndexSearcher.setSimilarity(searcher.getSimilarity(true));
    assertingIndexSearcher.setQueryCache(filterCache);
    assertingIndexSearcher.setQueryCachingPolicy(filterCachingPolicy);
    return assertingIndexSearcher;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:15,代码来源:MockEngineSupport.java

示例3: acquireIndexCommit

import org.elasticsearch.index.engine.EngineException; //导入依赖的package包/类
/**
 * Creates a new {@link IndexCommit} snapshot form the currently running engine. All resources referenced by this
 * commit won't be freed until the commit / snapshot is released via {@link #releaseIndexCommit(IndexCommit)}.
 *
 * @param flushFirst <code>true</code> if the index should first be flushed to disk / a low level lucene commit should be executed
 */
public IndexCommit acquireIndexCommit(boolean flushFirst) throws EngineException {
    IndexShardState state = this.state; // one time volatile read
    // we allow snapshot on closed index shard, since we want to do one after we close the shard and before we close the engine
    if (state == IndexShardState.STARTED || state == IndexShardState.RELOCATED || state == IndexShardState.CLOSED) {
        return getEngine().acquireIndexCommit(flushFirst);
    } else {
        throw new IllegalIndexShardStateException(shardId, state, "snapshot is not allowed");
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:16,代码来源:IndexShard.java

示例4: testSearchIsReleaseIfWrapperFails

import org.elasticsearch.index.engine.EngineException; //导入依赖的package包/类
public void testSearchIsReleaseIfWrapperFails() throws IOException {
    IndexShard shard = newStartedShard(true);
    indexDoc(shard, "test", "0", "{\"foo\" : \"bar\"}");
    shard.refresh("test");
    IndexSearcherWrapper wrapper = new IndexSearcherWrapper() {
        @Override
        public DirectoryReader wrap(DirectoryReader reader) throws IOException {
            throw new RuntimeException("boom");
        }

        @Override
        public IndexSearcher wrap(IndexSearcher searcher) throws EngineException {
            return searcher;
        }
    };

    closeShards(shard);
    IndexShard newShard = newShard(ShardRoutingHelper.reinitPrimary(shard.routingEntry()),
        shard.shardPath(), shard.indexSettings().getIndexMetaData(), wrapper, () -> {}, null);

    recoveryShardFromStore(newShard);

    try {
        newShard.acquireSearcher("test");
        fail("exception expected");
    } catch (RuntimeException ex) {
        //
    }
    closeShards(newShard);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:31,代码来源:IndexShardTests.java

示例5: snapshotIndex

import org.elasticsearch.index.engine.EngineException; //导入依赖的package包/类
public SnapshotIndexCommit snapshotIndex(boolean flushFirst) throws EngineException {
    IndexShardState state = this.state; // one time volatile read
    // we allow snapshot on closed index shard, since we want to do one after we close the shard and before we close the engine
    if (state == IndexShardState.STARTED || state == IndexShardState.RELOCATED || state == IndexShardState.CLOSED) {
        return engine().snapshotIndex(flushFirst);
    } else {
        throw new IllegalIndexShardStateException(shardId, state, "snapshot is not allowed");
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:10,代码来源:IndexShard.java

示例6: wrap

import org.elasticsearch.index.engine.EngineException; //导入依赖的package包/类
@Override
public final IndexSearcher wrap(final IndexSearcher searcher) throws EngineException {

    if (!isAdminAuthenticatedOrInternalRequest()) {
        return dlsFlsWrap(searcher);
    }

    return searcher;
}
 
开发者ID:floragunncom,项目名称:search-guard,代码行数:10,代码来源:SearchGuardIndexSearcherWrapper.java

示例7: forceMerge

import org.elasticsearch.index.engine.EngineException; //导入依赖的package包/类
@Override
public void forceMerge(boolean flush, int maxNumSegments,
        boolean onlyExpungeDeletes, boolean upgrade,
        boolean upgradeOnlyAncientSegments) throws EngineException {
    new EngineChain(engine, engineConfig, filters).doForceMerge(flush,
            maxNumSegments, onlyExpungeDeletes, upgrade,
            upgradeOnlyAncientSegments);
}
 
开发者ID:codelibs,项目名称:elasticsearch-extension,代码行数:9,代码来源:ExtendedEngine.java

示例8: doCreate

import org.elasticsearch.index.engine.EngineException; //导入依赖的package包/类
public void doCreate(final Create create) throws EngineException {
    if (position < filters.length) {
        final EngineFilter filter = filters[position];
        position++;
        filter.doCreate(create, this);
    } else {
        engine.create(create);
    }
}
 
开发者ID:codelibs,项目名称:elasticsearch-extension,代码行数:10,代码来源:EngineChain.java

示例9: doIndex

import org.elasticsearch.index.engine.EngineException; //导入依赖的package包/类
public void doIndex(final Index index) throws EngineException {
    if (position < filters.length) {
        final EngineFilter filter = filters[position];
        position++;
        filter.doIndex(index, this);
    } else {
        engine.index(index);
    }
}
 
开发者ID:codelibs,项目名称:elasticsearch-extension,代码行数:10,代码来源:EngineChain.java

示例10: doDelete

import org.elasticsearch.index.engine.EngineException; //导入依赖的package包/类
public void doDelete(final Delete delete) throws EngineException {
    if (position < filters.length) {
        final EngineFilter filter = filters[position];
        position++;
        filter.doDelete(delete, this);
    } else {
        engine.delete(delete);
    }
}
 
开发者ID:codelibs,项目名称:elasticsearch-extension,代码行数:10,代码来源:EngineChain.java

示例11: doGet

import org.elasticsearch.index.engine.EngineException; //导入依赖的package包/类
public GetResult doGet(final Get get) throws EngineException {
    if (position < filters.length) {
        final EngineFilter filter = filters[position];
        position++;
        return filter.doGet(get, this);
    } else {
        return engine.get(get);
    }
}
 
开发者ID:codelibs,项目名称:elasticsearch-extension,代码行数:10,代码来源:EngineChain.java

示例12: doMaybeMerge

import org.elasticsearch.index.engine.EngineException; //导入依赖的package包/类
public void doMaybeMerge() throws EngineException {
    if (position < filters.length) {
        final EngineFilter filter = filters[position];
        position++;
        filter.doMaybeMerge(this);
    } else {
        engine.maybeMerge();
    }
}
 
开发者ID:codelibs,项目名称:elasticsearch-extension,代码行数:10,代码来源:EngineChain.java

示例13: doRefresh

import org.elasticsearch.index.engine.EngineException; //导入依赖的package包/类
public void doRefresh(final String source) throws EngineException {
    if (position < filters.length) {
        final EngineFilter filter = filters[position];
        position++;
        filter.doRefresh(source, this);
    } else {
        engine.refresh(source);
    }
}
 
开发者ID:codelibs,项目名称:elasticsearch-extension,代码行数:10,代码来源:EngineChain.java

示例14: doFlush

import org.elasticsearch.index.engine.EngineException; //导入依赖的package包/类
public CommitId doFlush(final boolean force, final boolean waitIfOngoing)
        throws EngineException, FlushNotAllowedEngineException {
    if (position < filters.length) {
        final EngineFilter filter = filters[position];
        position++;
        return filter.doFlush(force, waitIfOngoing, this);
    } else {
        return engine.flush(force, waitIfOngoing);
    }
}
 
开发者ID:codelibs,项目名称:elasticsearch-extension,代码行数:11,代码来源:EngineChain.java

示例15: doSnapshotIndex

import org.elasticsearch.index.engine.EngineException; //导入依赖的package包/类
public SnapshotIndexCommit doSnapshotIndex() throws EngineException {
    if (position < filters.length) {
        final EngineFilter filter = filters[position];
        position++;
        return filter.doSnapshotIndex(this);
    } else {
        return engine.snapshotIndex();
    }
}
 
开发者ID:codelibs,项目名称:elasticsearch-extension,代码行数:10,代码来源:EngineChain.java


注:本文中的org.elasticsearch.index.engine.EngineException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。