Esempio n. 1
0
        public async Task TestAsyncAwaitContinuationIsExecutedWithConfiguredExecutor()
        {
            var cache = Ignite.GetOrCreateCache <int, int>(TestUtils.TestName);
            var key   = TestUtils.GetPrimaryKey(Ignite2, cache.Name);

            // This causes deadlock if async continuation is executed on the striped thread.
            await cache.PutAsync(key, 1);

            cache.Replace(key, 2);

            Assert.AreEqual(2, cache.Get(key));
            StringAssert.DoesNotContain("sys-stripe-", TestUtilsJni.GetJavaThreadName());
        }
Esempio n. 2
0
        public async Task TestSynchronousExecutorRunsContinuationsOnStripedPool()
        {
            var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration(name: "client"))
            {
                AsyncContinuationExecutor = AsyncContinuationExecutor.UnsafeSynchronous,
                ClientMode = true
            };

            using (var client = Ignition.Start(cfg))
            {
                var cache = client.GetOrCreateCache <int, int>(TestUtils.TestName);

                await cache.PutAsync(1, 1);

                StringAssert.StartsWith("sys-stripe-", TestUtilsJni.GetJavaThreadName());

                Assert.AreEqual(AsyncContinuationExecutor.UnsafeSynchronous,
                                client.GetConfiguration().AsyncContinuationExecutor);

                // Jump away from striped pool to avoid deadlock on node stop.
                await Task.Yield();
            }
        }
Esempio n. 3
0
        public async Task TestComputeExecuteAsyncContinuation()
        {
            await Ignite.GetCompute().ExecuteAsync(new StringLengthEmptyTask(), "abc");

            StringAssert.StartsWith("Thread-", TestUtilsJni.GetJavaThreadName());
        }
Esempio n. 4
0
        public async Task TestComputeRunAsyncContinuation()
        {
            await Ignite.GetCompute().RunAsync(new ComputeAction());

            StringAssert.StartsWith("Thread-", TestUtilsJni.GetJavaThreadName());
        }