Esempio n. 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void awaitOnline(org.neo4j.internal.kernel.api.IndexReference indexReference) throws org.neo4j.internal.kernel.api.exceptions.schema.IndexNotFoundKernelException
        private void AwaitOnline(IndexReference indexReference)
        {
            // We do the isAdded check on the transaction state first, because indexGetState will grab a schema read-lock, which can deadlock on the write-lock
            // held by the index populator. Also, if we index was created in this transaction, then we will never see it come online in this transaction anyway.
            // Indexes don't come online until the transaction that creates them has committed.
            if (!(( KernelTransactionImplementation )Tx).txState().indexDiffSetsBySchema(indexReference.Schema()).isAdded((IndexDescriptor)indexReference))
            {
                // If the index was not created in this transaction, then wait for it to come online before querying.
                Schema          schema = Db.schema();
                IndexDefinition index  = Schema.getIndexByName(indexReference.Name());
                Schema.awaitIndexOnline(index, _indexOnlineQueryTimeoutSeconds, TimeUnit.SECONDS);
            }
            // If the index was created in this transaction, then we skip this check entirely.
            // We will get an exception later, when we try to get an IndexReader, so this is fine.
        }