Beispiel #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static void runTest(Fixture fixture) throws InterruptedException, java.util.concurrent.ExecutionException
        private static void RunTest(Fixture fixture)
        {
            int          iterations   = fixture.Iterations();
            ResourceType resourceType = fixture.CreateResourceType();
            Locks        manager      = fixture.CreateLockManager(resourceType);

            try
            {
                using (Org.Neo4j.Kernel.impl.locking.Locks_Client a = manager.NewClient(), Org.Neo4j.Kernel.impl.locking.Locks_Client b = manager.NewClient())
                {
                    BinaryLatch     startLatch = new BinaryLatch();
                    BlockedCallable callA      = new BlockedCallable(startLatch, () => workloadA(fixture, a, resourceType, iterations));
                    BlockedCallable callB      = new BlockedCallable(startLatch, () => workloadB(fixture, b, resourceType, iterations));

                    Future <Void> futureA = _executor.submit(callA);
                    Future <Void> futureB = _executor.submit(callB);

                    callA.AwaitBlocked();
                    callB.AwaitBlocked();

                    startLatch.Release();

                    futureA.get();
                    futureB.get();
                }
            }
            finally
            {
                manager.Close();
            }
        }