public void UnorderedNonReentrantGrain(bool performDeadlockDetection) { IUnorderedNonReentrantGrain unonreentrant = this.grainFactory.GetGrain <IUnorderedNonReentrantGrain>(OrleansTestingBase.GetRandomGrainId()); unonreentrant.SetSelf(unonreentrant).Wait(); bool timeout = false; bool deadlock = false; try { timeout = !unonreentrant.Two().Wait(2000); } catch (Exception exc) { Exception baseExc = exc.GetBaseException(); if (baseExc.GetType().Equals(typeof(DeadlockException))) { deadlock = true; } else { Assert.True(false, $"Unexpected exception {exc.Message}: {exc.StackTrace}"); } } if (performDeadlockDetection) { Assert.True(deadlock, "Non-reentrant grain should deadlock"); } else { Assert.True(timeout, "Non-reentrant grain should timeout"); } this.logger.Info("Reentrancy UnorderedNonReentrantGrain Test finished OK."); }
public void UnorderedNonReentrantGrain() { IUnorderedNonReentrantGrain unonreentrant = GrainClient.GrainFactory.GetGrain <IUnorderedNonReentrantGrain>(GetRandomGrainId()); unonreentrant.SetSelf(unonreentrant).Wait(); bool timeout = false; bool deadlock = false; try { timeout = !unonreentrant.Two().Wait(2000); } catch (Exception exc) { Exception baseExc = exc.GetBaseException(); if (baseExc.GetType().Equals(typeof(DeadlockException))) { deadlock = true; } else { Assert.Fail("Unexpected exception {0}: {1}", exc.Message, exc.StackTrace); } } if (this.HostedCluster.Primary.Silo.GlobalConfig.PerformDeadlockDetection) { Assert.IsTrue(deadlock, "Non-reentrant grain should deadlock"); } else { Assert.IsTrue(timeout, "Non-reentrant grain should timeout"); } logger.Info("Reentrancy UnorderedNonReentrantGrain Test finished OK."); }