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


Java IndicesLifecycle類代碼示例

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


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

示例1: BlobRecoverySource

import org.elasticsearch.indices.IndicesLifecycle; //導入依賴的package包/類
@Inject
public BlobRecoverySource(Settings settings, TransportService transportService, IndicesService indicesService,
                          RecoverySettings recoverySettings, ClusterService clusterService,
                          BlobTransferTarget blobTransferTarget, BlobIndices blobIndices) {
    super(settings);
    this.transportService = transportService;
    this.indicesService = indicesService;
    this.clusterService = clusterService;
    this.blobTransferTarget = blobTransferTarget;
    this.blobIndices = blobIndices;
    this.indicesService.indicesLifecycle().addListener(new IndicesLifecycle.Listener() {
        @Override
        public void beforeIndexShardClosed(ShardId shardId, @Nullable IndexShard indexShard,
                                           Settings indexSettings) {
            if (indexShard != null) {
                ongoingRecoveries.cancel(indexShard, "shard is closed");
            }
        }
    });

    this.recoverySettings = recoverySettings;

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

示例2: BlobIndices

import org.elasticsearch.indices.IndicesLifecycle; //導入依賴的package包/類
@Inject
public BlobIndices(Settings settings,
                   Provider<TransportCreateIndexAction> transportCreateIndexActionProvider,
                   Provider<TransportDeleteIndexAction> transportDeleteIndexActionProvider,
                   Provider<TransportUpdateSettingsAction> transportUpdateSettingsActionProvider,
                   IndicesService indicesService,
                   IndicesLifecycle indicesLifecycle,
                   BlobEnvironment blobEnvironment,
                   ClusterService clusterService) {
    super(settings);
    this.transportCreateIndexActionProvider = transportCreateIndexActionProvider;
    this.transportDeleteIndexActionProvider = transportDeleteIndexActionProvider;
    this.transportUpdateSettingsActionProvider = transportUpdateSettingsActionProvider;
    this.indicesService = indicesService;
    this.indicesLifecycle = indicesLifecycle;
    this.blobEnvironment = blobEnvironment;
    clusterService.addFirst(this);
    logger.setLevel("debug");
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:20,代碼來源:BlobIndices.java

示例3: RecoverySource

import org.elasticsearch.indices.IndicesLifecycle; //導入依賴的package包/類
@Inject
public RecoverySource(Settings settings, TransportService transportService, IndicesService indicesService,
                      RecoverySettings recoverySettings, ClusterService clusterService) {
    super(settings);
    this.transportService = transportService;
    this.indicesService = indicesService;
    this.clusterService = clusterService;
    this.indicesService.indicesLifecycle().addListener(new IndicesLifecycle.Listener() {
        @Override
        public void beforeIndexShardClosed(ShardId shardId, @Nullable IndexShard indexShard,
                                           Settings indexSettings) {
            if (indexShard != null) {
                ongoingRecoveries.cancel(indexShard, "shard is closed");
            }
        }
    });

    this.recoverySettings = recoverySettings;

    transportService.registerRequestHandler(Actions.START_RECOVERY, StartRecoveryRequest.class, ThreadPool.Names.GENERIC, new StartRecoveryTransportRequestHandler());
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:22,代碼來源:RecoverySource.java

示例4: ShadowIndexShard

import org.elasticsearch.indices.IndicesLifecycle; //導入依賴的package包/類
@Inject
public ShadowIndexShard(ShardId shardId, IndexSettingsService indexSettingsService,
                        IndicesLifecycle indicesLifecycle, Store store, StoreRecoveryService storeRecoveryService,
                        ThreadPool threadPool, MapperService mapperService,
                        IndexQueryParserService queryParserService, IndexCache indexCache,
                        IndexAliasesService indexAliasesService, IndicesQueryCache indicesQueryCache,
                        ShardPercolateService shardPercolateService, CodecService codecService,
                        ShardTermVectorsService termVectorsService, IndexFieldDataService indexFieldDataService,
                        IndexService indexService, @Nullable IndicesWarmer warmer,
                        SnapshotDeletionPolicy deletionPolicy, SimilarityService similarityService,
                        EngineFactory factory, ClusterService clusterService,
                        ShardPath path, BigArrays bigArrays, IndexSearcherWrappingService wrappingService,
                        IndexingMemoryController indexingMemoryController, SearchService shardSearchService) throws IOException {
    super(shardId, indexSettingsService, indicesLifecycle, store, storeRecoveryService,
          threadPool, mapperService, queryParserService, indexCache, indexAliasesService,
          indicesQueryCache, shardPercolateService, codecService,
          termVectorsService, indexFieldDataService, indexService,
          warmer, deletionPolicy, similarityService,
          factory, clusterService, path, bigArrays, wrappingService, indexingMemoryController, shardSearchService);
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:21,代碼來源:ShadowIndexShard.java

示例5: DLBasedIndexShard

import org.elasticsearch.indices.IndicesLifecycle; //導入依賴的package包/類
@Inject
public DLBasedIndexShard(ShardId shardId,
        IndexSettingsService indexSettingsService,
        IndicesLifecycle indicesLifecycle, Store store,
        StoreRecoveryService storeRecoveryService, ThreadPool threadPool,
        MapperService mapperService,
        IndexQueryParserService queryParserService, IndexCache indexCache,
        IndexAliasesService indexAliasesService,
        IndicesQueryCache indicesQueryCache,
        ShardPercolateService shardPercolateService,
        CodecService codecService,
        ShardTermVectorsService termVectorsService,
        IndexFieldDataService indexFieldDataService,
        IndexService indexService, IndicesWarmer warmer,
        SnapshotDeletionPolicy deletionPolicy,
        SimilarityService similarityService, EngineFactory factory,
        ClusterService clusterService, ShardPath path, BigArrays bigArrays,
        IndexSearcherWrappingService wrappingService,
        IndexingMemoryController indexingMemoryController,
        TransportGetOrChangePrimaryShardLeaseAction checkLeaseAction,
        TransportIndexShardStatsAction indexShardStatsAction,
        SearchService shardSearchService) {
    super(shardId, indexSettingsService, indicesLifecycle, store,
            storeRecoveryService, threadPool, mapperService, queryParserService,
            indexCache, indexAliasesService, indicesQueryCache,
            shardPercolateService, codecService, termVectorsService,
            indexFieldDataService, indexService, warmer, deletionPolicy,
            similarityService, factory, clusterService, path, bigArrays,
            wrappingService, indexingMemoryController, shardSearchService);
    this.localNodeId = clusterService.state().nodes().localNodeId();
    this.checkLeaseAction = checkLeaseAction;
    this.indexShardStatsAction = indexShardStatsAction;
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:34,代碼來源:DLBasedIndexShard.java

示例6: BlobRecoveryTarget

import org.elasticsearch.indices.IndicesLifecycle; //導入依賴的package包/類
@Inject
public BlobRecoveryTarget(Settings settings, IndicesLifecycle indicesLifecycle, RecoveryTarget indexRecoveryTarget,
        IndicesService indicesService, TransportService transportService) {
    super(settings);
    this.indexRecoveryTarget = indexRecoveryTarget;
    this.indicesService = indicesService;

    transportService.registerRequestHandler(Actions.START_RECOVERY, BlobStartRecoveryRequest.class, ThreadPool.Names.GENERIC, new StartRecoveryRequestHandler());
    transportService.registerRequestHandler(Actions.START_PREFIX, BlobStartPrefixSyncRequest.class, ThreadPool.Names.GENERIC, new StartPrefixSyncRequestHandler());
    transportService.registerRequestHandler(Actions.TRANSFER_CHUNK, BlobRecoveryChunkRequest.class, ThreadPool.Names.GENERIC, new TransferChunkRequestHandler());
    transportService.registerRequestHandler(Actions.START_TRANSFER, BlobRecoveryStartTransferRequest.class, ThreadPool.Names.GENERIC, new StartTransferRequestHandler());
    transportService.registerRequestHandler(Actions.DELETE_FILE, BlobRecoveryDeleteRequest.class, ThreadPool.Names.GENERIC, new DeleteFileRequestHandler());
    transportService.registerRequestHandler(Actions.FINALIZE_RECOVERY, BlobFinalizeRecoveryRequest.class, ThreadPool.Names.GENERIC, new FinalizeRecoveryRequestHandler());
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:15,代碼來源:BlobRecoveryTarget.java

示例7: BlobShardFuture

import org.elasticsearch.indices.IndicesLifecycle; //導入依賴的package包/類
public BlobShardFuture(final BlobIndices blobIndices, final IndicesLifecycle indicesLifecycle,
                       final String index, final int shardId)
{
    BlobShard blobShard = blobIndices.blobShard(index, shardId);
    if (blobShard != null) {
        set(blobShard);
        return;
    }

    IndicesLifecycle.Listener listener = new IndicesLifecycle.Listener() {

        @Override
        public void afterIndexShardCreated(IndexShard indexShard) {
            super.afterIndexShardCreated(indexShard);
            if (indexShard.shardId().index().getName().equals(index)) {
                set(blobIndices.blobShardSafe(index, shardId));
                indicesLifecycle.removeListener(this);
            }
        }
    };
    indicesLifecycle.addListener(listener);

    /**
     * prevent race condition:
     * if the index is created before the listener is added
     * but after the first blobShard() call
     */
    if (!isDone()) {
        blobShard = blobIndices.blobShard(index, shardId);
        if (blobShard != null) {
            indicesLifecycle.removeListener(listener);
            set(blobShard);
        }
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:36,代碼來源:BlobShardFuture.java

示例8: SyncedFlushService

import org.elasticsearch.indices.IndicesLifecycle; //導入依賴的package包/類
@Inject
public SyncedFlushService(Settings settings, IndicesService indicesService, ClusterService clusterService, TransportService transportService, IndexNameExpressionResolver indexNameExpressionResolver) {
    super(settings);
    this.indicesService = indicesService;
    this.clusterService = clusterService;
    this.transportService = transportService;
    this.indexNameExpressionResolver = indexNameExpressionResolver;

    transportService.registerRequestHandler(PRE_SYNCED_FLUSH_ACTION_NAME, PreShardSyncedFlushRequest.class, ThreadPool.Names.FLUSH, new PreSyncedFlushTransportHandler());
    transportService.registerRequestHandler(SYNCED_FLUSH_ACTION_NAME, ShardSyncedFlushRequest.class, ThreadPool.Names.FLUSH, new SyncedFlushTransportHandler());
    transportService.registerRequestHandler(IN_FLIGHT_OPS_ACTION_NAME, InFlightOpsRequest.class, ThreadPool.Names.SAME, new InFlightOpCountTransportHandler());
    indicesService.indicesLifecycle().addListener(new IndicesLifecycle.Listener() {
        @Override
        public void onShardInactive(final IndexShard indexShard) {
            // we only want to call sync flush once, so only trigger it when we are on a primary
            if (indexShard.routingEntry().primary()) {
                attemptSyncedFlush(indexShard.shardId(), new ActionListener<ShardsSyncedFlushResult>() {
                    @Override
                    public void onResponse(ShardsSyncedFlushResult syncedFlushResult) {
                        logger.trace("{} sync flush on inactive shard returned successfully for sync_id: {}", syncedFlushResult.getShardId(), syncedFlushResult.syncId());
                    }

                    @Override
                    public void onFailure(Throwable e) {
                        logger.debug("{} sync flush on inactive shard failed", e, indexShard.shardId());
                    }
                });
            }
        }
    });
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:32,代碼來源:SyncedFlushService.java

示例9: RecoveryTarget

import org.elasticsearch.indices.IndicesLifecycle; //導入依賴的package包/類
@Inject
public RecoveryTarget(Settings settings, ThreadPool threadPool, TransportService transportService,
                      IndicesLifecycle indicesLifecycle, RecoverySettings recoverySettings, ClusterService clusterService) {
    super(settings);
    this.threadPool = threadPool;
    this.transportService = transportService;
    this.recoverySettings = recoverySettings;
    this.clusterService = clusterService;
    this.onGoingRecoveries = new RecoveriesCollection(logger, threadPool);

    transportService.registerRequestHandler(Actions.FILES_INFO, RecoveryFilesInfoRequest.class, ThreadPool.Names.GENERIC, new FilesInfoRequestHandler());
    transportService.registerRequestHandler(Actions.FILE_CHUNK, RecoveryFileChunkRequest.class, ThreadPool.Names.GENERIC, new FileChunkTransportRequestHandler());
    transportService.registerRequestHandler(Actions.CLEAN_FILES, RecoveryCleanFilesRequest.class, ThreadPool.Names.GENERIC, new CleanFilesRequestHandler());
    transportService.registerRequestHandler(Actions.PREPARE_TRANSLOG, RecoveryPrepareForTranslogOperationsRequest.class, ThreadPool.Names.GENERIC, new PrepareForTranslogOperationsRequestHandler());
    transportService.registerRequestHandler(Actions.TRANSLOG_OPS, RecoveryTranslogOperationsRequest.class, ThreadPool.Names.GENERIC, new TranslogOperationsRequestHandler());
    transportService.registerRequestHandler(Actions.CHECK_TRANSLOG_OFFSET, RecoveryCheckTranslogOffsetRequest.class, ThreadPool.Names.GENERIC, new CheckTranslogOffsetRequestHandler());
    transportService.registerRequestHandler(Actions.FINALIZE, RecoveryFinalizeRecoveryRequest.class, ThreadPool.Names.GENERIC, new FinalizeRecoveryRequestHandler());

    indicesLifecycle.addListener(new IndicesLifecycle.Listener() {
        @Override
        public void beforeIndexShardClosed(ShardId shardId, @Nullable IndexShard indexShard, Settings indexSettings) {
            if (indexShard != null) {
                onGoingRecoveries.cancelRecoveriesForShard(shardId, "shard closed");
            }
        }
    });
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:28,代碼來源:RecoveryTarget.java

示例10: PercolatorQueriesRegistry

import org.elasticsearch.indices.IndicesLifecycle; //導入依賴的package包/類
public PercolatorQueriesRegistry(ShardId shardId, Settings indexSettings, IndexQueryParserService queryParserService,
                                 ShardIndexingService indexingService, IndicesLifecycle indicesLifecycle, MapperService mapperService,
                                 IndexFieldDataService indexFieldDataService, ShardPercolateService shardPercolateService) {
    super(shardId, indexSettings);
    this.queryParserService = queryParserService;
    this.mapperService = mapperService;
    this.indicesLifecycle = indicesLifecycle;
    this.indexingService = indexingService;
    this.indexFieldDataService = indexFieldDataService;
    this.shardPercolateService = shardPercolateService;
    this.mapUnmappedFieldsAsString = indexSettings.getAsBoolean(MAP_UNMAPPED_FIELDS_AS_STRING, false);

    indicesLifecycle.addListener(shardLifecycleListener);
    mapperService.addTypeListener(percolateTypeListener);
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:16,代碼來源:PercolatorQueriesRegistry.java

示例11: IndexService

import org.elasticsearch.indices.IndicesLifecycle; //導入依賴的package包/類
@Inject
public IndexService(Injector injector, Index index, NodeEnvironment nodeEnv,
                    AnalysisService analysisService, MapperService mapperService, IndexQueryParserService queryParserService,
                    SimilarityService similarityService, IndexAliasesService aliasesService, IndexCache indexCache,
                    IndexSettingsService settingsService,
                    IndexFieldDataService indexFieldData, BitsetFilterCache bitSetFilterCache, IndicesService indicesServices) {

    super(index, settingsService.getSettings());
    this.injector = injector;
    this.analysisService = analysisService;
    this.mapperService = mapperService;
    this.queryParserService = queryParserService;
    this.similarityService = similarityService;
    this.aliasesService = aliasesService;
    this.indexCache = indexCache;
    this.indexFieldData = indexFieldData;
    this.settingsService = settingsService;
    this.bitsetFilterCache = bitSetFilterCache;

    this.pluginsService = injector.getInstance(PluginsService.class);
    this.indicesServices = indicesServices;
    this.indicesLifecycle = (InternalIndicesLifecycle) injector.getInstance(IndicesLifecycle.class);

    // inject workarounds for cyclic dep
    indexFieldData.setListener(new FieldDataCacheListener(this));
    bitSetFilterCache.setListener(new BitsetCacheListener(this));
    this.nodeEnv = nodeEnv;
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:29,代碼來源:IndexService.java

示例12: IndexShard

import org.elasticsearch.indices.IndicesLifecycle; //導入依賴的package包/類
@Inject
public IndexShard(ShardId shardId, IndexSettingsService indexSettingsService, IndicesLifecycle indicesLifecycle, Store store,
                  StoreRecoveryService storeRecoveryService,
                  ThreadPool threadPool, MapperService mapperService, IndexQueryParserService queryParserService, IndexCache
                          indexCache, IndexAliasesService indexAliasesService,
                  IndicesQueryCache indicesQueryCache, ShardPercolateService shardPercolateService, CodecService codecService,
                  ShardTermVectorsService termVectorsService, IndexFieldDataService indexFieldDataService, IndexService indexService,
                  @Nullable IndicesWarmer warmer, SnapshotDeletionPolicy deletionPolicy, SimilarityService similarityService,
                  EngineFactory factory,
                  ClusterService clusterService, ShardPath path, BigArrays bigArrays, IndexSearcherWrappingService wrappingService,
                  IndexingMemoryController indexingMemoryController, SearchService shardSearchService) {
    super(shardId, indexSettingsService.getSettings());
    this.codecService = codecService;
    this.warmer = warmer;
    this.deletionPolicy = deletionPolicy;
    this.similarityService = similarityService;
    this.wrappingService = wrappingService;
    Preconditions.checkNotNull(store, "Store must be provided to the index shard");
    Preconditions.checkNotNull(deletionPolicy, "Snapshot deletion policy must be provided to the index shard");
    this.engineFactory = factory;
    this.indicesLifecycle = (InternalIndicesLifecycle) indicesLifecycle;
    this.indexSettingsService = indexSettingsService;
    this.store = store;
    this.storeRecoveryService = storeRecoveryService;
    this.mergeSchedulerConfig = new MergeSchedulerConfig(indexSettings);
    this.threadPool = threadPool;
    this.mapperService = mapperService;
    this.queryParserService = queryParserService;
    this.indexCache = indexCache;
    this.indexAliasesService = indexAliasesService;
    this.indexingService = new ShardIndexingService(shardId, indexSettings);
    this.getService = new ShardGetService(this, mapperService);
    this.termVectorsService = termVectorsService.setIndexShard(this);
    this.searchService = new ShardSearchStats(indexSettings);
    this.shardWarmerService = new ShardIndexWarmerService(shardId, indexSettings);
    this.indicesQueryCache = indicesQueryCache;
    this.shardQueryCache = new ShardRequestCache(shardId, indexSettings);
    this.shardFieldData = new ShardFieldData();
    this.percolatorQueriesRegistry = new PercolatorQueriesRegistry(shardId, indexSettings, queryParserService, indexingService,
            indicesLifecycle, mapperService, indexFieldDataService, shardPercolateService);
    this.shardPercolateService = shardPercolateService;
    this.indexFieldDataService = indexFieldDataService;
    this.indexService = indexService;
    this.shardBitsetFilterCache = new ShardBitsetFilterCache(shardId, indexSettings);
    assert clusterService.localNode() != null : "Local node is null lifecycle state is: " + clusterService.lifecycleState();
    this.clusterService = clusterService;
    this.localNode = clusterService.localNode();
    state = IndexShardState.CREATED;
    this.refreshInterval = indexSettings.getAsTime(INDEX_REFRESH_INTERVAL, EngineConfig.DEFAULT_REFRESH_INTERVAL);
    this.flushOnClose = indexSettings.getAsBoolean(INDEX_FLUSH_ON_CLOSE, true);
    // set it to 0 means reindex is disabled
    this.reindexBatchSize = indexSettings.getAsInt(INDEX_REINDEX_BATCH_SIZE, 0);
    this.reindexInterval = indexSettings.getAsTime(INDEX_REINDEX_INTERVAL, TimeValue.timeValueSeconds(10));
    indexSettingsService.addListener(applyRefreshSettings);
    this.path = path;
    this.mergePolicyConfig = new MergePolicyConfig(logger, indexSettings);
    /* create engine config */

    logger.debug("state: [CREATED]");

    this.checkIndexOnStartup = indexSettings.get("index.shard.check_on_startup", "false");
    this.translogConfig = new TranslogConfig(shardId, shardPath().resolveTranslog(), indexSettings, getFromSettings(logger,
            indexSettings, Translog.Durabilty.REQUEST),
            bigArrays, threadPool);
    final QueryCachingPolicy cachingPolicy;
    // the query cache is a node-level thing, however we want the most popular filters
    // to be computed on a per-shard basis
    if (indexSettings.getAsBoolean(IndexCacheModule.QUERY_CACHE_EVERYTHING, false)) {
        cachingPolicy = QueryCachingPolicy.ALWAYS_CACHE;
    } else {
        cachingPolicy = new XUsageTrackingQueryCachingPolicy();
    }
    this.engineConfig = newEngineConfig(translogConfig, cachingPolicy);
    this.indexShardOperationCounter = new IndexShardOperationCounter(logger, shardId);

    this.indexingMemoryController = indexingMemoryController;

    // We start up inactive
    active.set(false);
    this.shardSearchService = shardSearchService;
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:82,代碼來源:IndexShard.java


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