private ThreadStart PutIndexProxy(IndexMapReference @ref, IndexProxy proxy) { return(() => @ref.modify(indexMap => { indexMap.putIndexProxy(proxy); return indexMap; })); }
private ThreadStart RemoveIndexProxy(IndexMapReference @ref, long indexId) { return(() => @ref.modify(indexMap => { indexMap.removeIndexProxy(indexId); return indexMap; })); }
public static IndexingService CreateIndexingService(Config config, JobScheduler scheduler, IndexProviderMap providerMap, IndexStoreView storeView, TokenNameLookup tokenNameLookup, IEnumerable <SchemaRule> schemaRules, LogProvider internalLogProvider, LogProvider userLogProvider, IndexingService.Monitor monitor, SchemaState schemaState, bool readOnly) { IndexSamplingConfig samplingConfig = new IndexSamplingConfig(config); MultiPopulatorFactory multiPopulatorFactory = MultiPopulatorFactory.ForConfig(config); IndexMapReference indexMapRef = new IndexMapReference(); IndexSamplingControllerFactory factory = new IndexSamplingControllerFactory(samplingConfig, storeView, scheduler, tokenNameLookup, internalLogProvider); IndexSamplingController indexSamplingController = factory.Create(indexMapRef); IndexProxyCreator proxySetup = new IndexProxyCreator(samplingConfig, storeView, providerMap, tokenNameLookup, internalLogProvider); return(new IndexingService(proxySetup, providerMap, indexMapRef, storeView, schemaRules, indexSamplingController, tokenNameLookup, scheduler, schemaState, multiPopulatorFactory, internalLogProvider, userLogProvider, monitor, readOnly)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSynchronizeModifications() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldSynchronizeModifications() { // given IndexMapReference @ref = new IndexMapReference(); IndexProxy[] existing = MockedIndexProxies(5, 0); @ref.Modify(indexMap => { for (int i = 0; i < existing.Length; i++) { indexMap.putIndexProxy(existing[i]); } return(indexMap); }); // when Race race = new Race(); for (int i = 0; i < existing.Length; i++) { race.AddContestant(RemoveIndexProxy(@ref, i), 1); } IndexProxy[] created = MockedIndexProxies(3, existing.Length); for (int i = 0; i < existing.Length; i++) { race.AddContestant(PutIndexProxy(@ref, created[i]), 1); } race.Go(); // then for (int i = 0; i < existing.Length; i++) { assertNull(@ref.getIndexProxy(i)); } for (int i = 0; i < created.Length; i++) { assertSame(created[i], @ref.getIndexProxy(existing.Length + i)); } }