本文整理汇总了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;
}
示例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");
}
示例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());
}
示例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);
}
示例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;
}
示例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());
}
示例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);
}
}
}
示例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());
}
});
}
}
});
}
示例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");
}
}
});
}
示例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);
}
示例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;
}
示例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;
}