예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void failedInstanceShouldReceiveCorrectCoordinatorIdUponRejoiningCluster() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void FailedInstanceShouldReceiveCorrectCoordinatorIdUponRejoiningCluster()
        {
            // Given
            HighlyAvailableGraphDatabase initialMaster = _cluster.Master;

            // When
            _cluster.shutdown(initialMaster);
            _cluster.await(masterAvailable(initialMaster));
            _cluster.await(masterSeesSlavesAsAvailable(1));

            // create node on new master to ensure that it has the greatest tx id
            CreateNodeOn(_cluster.Master);
            _cluster.sync();

            LifeSupport         life          = new LifeSupport();
            ClusterClientModule clusterClient = NewClusterClient(life, new InstanceId(1));

            Cleanup.add(life);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.concurrent.atomic.AtomicReference<org.neo4j.cluster.InstanceId> coordinatorIdWhenReJoined = new java.util.concurrent.atomic.AtomicReference<>();
            AtomicReference <InstanceId> coordinatorIdWhenReJoined = new AtomicReference <InstanceId>();

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.concurrent.CountDownLatch latch = new java.util.concurrent.CountDownLatch(1);
            System.Threading.CountdownEvent latch = new System.Threading.CountdownEvent(1);
            clusterClient.ClusterClient.addClusterListener(new ClusterListener_AdapterAnonymousInnerClass(this, coordinatorIdWhenReJoined, latch));

            life.Start();

            // Then
            assertTrue(latch.await(20, SECONDS));
            assertEquals(new InstanceId(2), coordinatorIdWhenReJoined.get());
        }
예제 #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.kernel.impl.ha.ClusterManager.RepairKit takeExclusiveLockAndKillSlave(org.neo4j.graphdb.Label testLabel, org.neo4j.kernel.ha.HighlyAvailableGraphDatabase db) throws org.neo4j.internal.kernel.api.exceptions.EntityNotFoundException
        private ClusterManager.RepairKit TakeExclusiveLockAndKillSlave(Label testLabel, HighlyAvailableGraphDatabase db)
        {
            TakeExclusiveLock(testLabel, db);
            return(_cluster.shutdown(db));
        }