private boolean shouldRunIndexer(IndexerDefinition indexerDef) { return indexerDef.getIncrementalIndexingState() == IncrementalIndexingState.SUBSCRIBE_AND_CONSUME && indexerDef.getSubscriptionId() != null && !indexerDef.getLifecycleState().isDeleteState(); }
private boolean needsBatchBuildStart(IndexerDefinition indexer) { return !indexer.getLifecycleState().isDeleteState() && indexer.getBatchIndexingState() == BatchIndexingState.BUILD_REQUESTED && indexer.getActiveBatchBuildInfo() == null; }
private void notifyListeners(List<IndexerModelEvent> events) { for (IndexerModelEvent event : events) { for (IndexerModelListener listener : listeners) { listener.process(event); } } }
public IndexerDefinitionBuilder startFrom(IndexerDefinition existingDefinition) { this.name = existingDefinition.getName(); this.lifecycleState = existingDefinition.getLifecycleState(); this.batchIndexingState = existingDefinition.getBatchIndexingState(); this.incrementalIndexingState = existingDefinition.getIncrementalIndexingState(); this.subscriptionId = existingDefinition.getSubscriptionId(); this.configuration = existingDefinition.getConfiguration(); this.indexerComponentFactory = existingDefinition.getIndexerComponentFactory(); this.connectionType = existingDefinition.getConnectionType(); this.connectionParams = existingDefinition.getConnectionParams(); this.defaultBatchIndexCliArguments = existingDefinition.getDefaultBatchIndexCliArguments(); this.batchIndexCliArguments = existingDefinition.getBatchIndexCliArguments(); this.lastBatchBuildInfo = existingDefinition.getLastBatchBuildInfo(); this.activeBatchBuildInfo = existingDefinition.getActiveBatchBuildInfo(); this.subscriptionTimestamp = existingDefinition.getSubscriptionTimestamp(); this.occVersion = existingDefinition.getOccVersion(); return this; }
@Override public void activateAsLeader() throws Exception { log.info("Starting up as indexer master."); // Start these processes, but it is not until we have registered our model listener // that these will receive work. eventWorker.start(); Collection<IndexerDefinition> indexers = indexerModel.getIndexers(listener); // Rather than performing any work that might to be done for the indexers here, // we push out fake events. This way there's only one place where these actions // need to be performed. for (IndexerDefinition index : indexers) { eventWorker.putEvent(new IndexerModelEvent(INDEXER_UPDATED, index.getName())); } log.info("Startup as indexer master successful."); }
private boolean needsSubscriptionIdUnassigned(IndexerDefinition indexer) { return indexer.getIncrementalIndexingState() == IncrementalIndexingState.DO_NOT_SUBSCRIBE && indexer.getSubscriptionId() != null; }
public BatchBuildInfo finishedSuccessfully(boolean finishedSuccessful) { BatchBuildInfo batchBuildInfo = new BatchBuildInfo(this); batchBuildInfo.finishedSuccessful = finishedSuccessful; return batchBuildInfo; }
@Override public IndexerDefinition getIndexer(String name) throws IndexerNotFoundException { IndexerDefinition index = indexers.get(name); if (index == null) { throw new IndexerNotFoundException(name); } return index; }
public IndexesInfoImpl(IndexerModel indexerModel, RepositoryManager repositoryManager) { this.indexerModel = indexerModel; this.repositoryManager = repositoryManager; indexerModel.registerListener(listener); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + type.hashCode(); result = prime * result + indexerName.hashCode(); return result; }
public IndexerDefinition build() { Preconditions.checkNotNull(name, "name"); Preconditions.checkNotNull(lifecycleState, "lifecycleState"); Preconditions.checkNotNull(batchIndexingState, "batchIndexingState"); Preconditions.checkNotNull(incrementalIndexingState, "incrementalIndexingState"); return new IndexerDefinition(name, lifecycleState, batchIndexingState, incrementalIndexingState, subscriptionId, configuration, indexerComponentFactory, connectionType, connectionParams, defaultBatchIndexCliArguments, batchIndexCliArguments, lastBatchBuildInfo, activeBatchBuildInfo, subscriptionTimestamp, occVersion); } }
private boolean needsSubscriptionIdAssigned(IndexerDefinition indexer) { return !indexer.getLifecycleState().isDeleteState() && indexer.getIncrementalIndexingState() != IncrementalIndexingState.DO_NOT_SUBSCRIBE && indexer.getSubscriptionId() == null; }
private boolean needsBatchBuildStart(IndexerDefinition indexer) { return !indexer.getLifecycleState().isDeleteState() && indexer.getBatchIndexingState() == BatchIndexingState.BUILD_REQUESTED && indexer.getActiveBatchBuildInfo() == null; }
@Override public void activateAsLeader() throws Exception { log.info("Starting up as indexer master."); // Start these processes, but it is not until we have registered our model listener // that these will receive work. eventWorker.start(); Collection<IndexerDefinition> indexers = indexerModel.getIndexers(listener); // Rather than performing any work that might to be done for the indexers here, // we push out fake events. This way there's only one place where these actions // need to be performed. for (IndexerDefinition index : indexers) { eventWorker.putEvent(new IndexerModelEvent(INDEXER_UPDATED, index.getName())); } log.info("Startup as indexer master successful."); }
private boolean needsSubscriptionIdUnassigned(IndexerDefinition indexer) { return indexer.getIncrementalIndexingState() == IncrementalIndexingState.DO_NOT_SUBSCRIBE && indexer.getSubscriptionId() != null; }
public BatchBuildInfo finishedSuccessfully(boolean finishedSuccessful) { BatchBuildInfo batchBuildInfo = new BatchBuildInfo(this); batchBuildInfo.finishedSuccessful = finishedSuccessful; return batchBuildInfo; }
private void notifyListeners(List<IndexerModelEvent> events) { for (IndexerModelEvent event : events) { for (IndexerModelListener listener : listeners) { listener.process(event); } } }
private boolean needsSubscriptionIdAssigned(IndexerDefinition indexer) { return !indexer.getLifecycleState().isDeleteState() && indexer.getIncrementalIndexingState() != IncrementalIndexingState.DO_NOT_SUBSCRIBE && indexer.getSubscriptionId() == null; }
private boolean shouldRunIndexer(IndexerDefinition indexerDef) { return indexerDef.getIncrementalIndexingState() == IncrementalIndexingState.SUBSCRIBE_AND_CONSUME && indexerDef.getSubscriptionId() != null && !indexerDef.getLifecycleState().isDeleteState(); }