Exemplo n.º 1
0
 private void CreateExplicitIndex()
 {
     using (Transaction tx = Db.beginTx())
     {
         Db.index().forNodes(_explicitIndexName);
         Db.index().forRelationships(_relExplicitIndexName);
         tx.Success();
     }
 }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(timeout = 15000) public void commitDuringContinuousCheckpointing() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void CommitDuringContinuousCheckpointing()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.graphdb.index.Index<org.neo4j.graphdb.Node> index;
            Index <Node> index;

            using (Transaction tx = Db.beginTx())
            {
                index = Db.index().forNodes(INDEX_NAME, stringMap(Org.Neo4j.Graphdb.index.IndexManager_Fields.PROVIDER, DummyIndexExtensionFactory.IDENTIFIER));
                tx.Success();
            }

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.concurrent.atomic.AtomicBoolean done = new java.util.concurrent.atomic.AtomicBoolean();
            AtomicBoolean         done    = new AtomicBoolean();
            Workers <ThreadStart> workers = new Workers <ThreadStart>(this.GetType().Name);

            for (int i = 0; i < TOTAL_ACTIVE_THREADS; i++)
            {
                workers.Start(new RunnableAnonymousInnerClass(this, index, tx, done));
            }

            Thread.Sleep(SECONDS.toMillis(2));
            done.set(true);
            workers.AwaitAndThrowOnError();

            NeoStores neoStores = GetDependency(typeof(RecordStorageEngine)).testAccessNeoStores();

            assertThat("Count store should be rotated once at least", neoStores.Counts.txId(), greaterThan(0L));

            long lastRotationTx          = GetDependency(typeof(CheckPointer)).forceCheckPoint(new SimpleTriggerInfo("test"));
            TransactionIdStore txIdStore = GetDependency(typeof(TransactionIdStore));

            assertEquals("NeoStore last closed transaction id should be equal last count store rotation transaction id.", txIdStore.LastClosedTransactionId, lastRotationTx);
            assertEquals("Last closed transaction should be last rotated tx in count store", txIdStore.LastClosedTransactionId, neoStores.Counts.txId());
        }