public override void AwaitIndexOnline(IndexDefinition index, long duration, TimeUnit unit) { _actions.assertInOpenTransaction(); long timeout = DateTimeHelper.CurrentUnixTimeMillis() + unit.toMillis(duration); do { Org.Neo4j.Graphdb.schema.Schema_IndexState state = GetIndexState(index); switch (state) { case Org.Neo4j.Graphdb.schema.Schema_IndexState.Online: return; case Org.Neo4j.Graphdb.schema.Schema_IndexState.Failed: string cause = GetIndexFailure(index); string message = IndexPopulationFailure.appendCauseOfFailure(string.Format("Index {0} entered a {1} state. Please see database logs.", index, state), cause); throw new System.InvalidOperationException(message); default: try { Thread.Sleep(100); } catch (InterruptedException) { // Ignore interrupted exceptions here. } break; } } while (DateTimeHelper.CurrentUnixTimeMillis() < timeout); throw new System.InvalidOperationException("Expected index to come online within a reasonable time."); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private boolean isOnline(IndexSpecifier specifier, org.neo4j.internal.kernel.api.IndexReference index) throws org.neo4j.internal.kernel.api.exceptions.ProcedureException private bool IsOnline(IndexSpecifier specifier, IndexReference index) { InternalIndexState state = GetState(specifier, index); switch (state) { case InternalIndexState.POPULATING: return(false); case InternalIndexState.ONLINE: return(true); case InternalIndexState.FAILED: string cause = GetFailure(specifier, index); throw new ProcedureException(Org.Neo4j.Kernel.Api.Exceptions.Status_Schema.IndexCreationFailed, IndexPopulationFailure.appendCauseOfFailure("Index %s is in failed state.", cause), specifier); default: throw new System.InvalidOperationException("Unknown index state " + state); } }