public void NonReentrantGrain() { INonReentrantGrain nonreentrant = GrainClient.GrainFactory.GetGrain <INonReentrantGrain>(GetRandomGrainId()); nonreentrant.SetSelf(nonreentrant).Wait(); bool timeout = false; bool deadlock = false; try { timeout = !nonreentrant.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 NonReentrantGrain Test finished OK."); }
public void NonReentrantGrain(bool performDeadlockDetection) { INonReentrantGrain nonreentrant = this.grainFactory.GetGrain <INonReentrantGrain>(OrleansTestingBase.GetRandomGrainId()); nonreentrant.SetSelf(nonreentrant).Wait(); bool timeout = false; bool deadlock = false; try { timeout = !nonreentrant.Two().Wait(2000); } catch (Exception exc) { Exception baseExc = exc.GetBaseException(); if (baseExc.GetType().Equals(typeof(DeadlockException))) { deadlock = true; } else { Assert.True(false, string.Format("Unexpected exception {0}: {1}", 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 NonReentrantGrain Test finished OK."); }
public Task ScheduleDelayedIncrement(INonReentrantGrain target, TimeSpan delay) { RegisterTimer(async o => { await target.IncrementCounter(); }, null, delay, TimeSpan.FromMilliseconds(-1)); return(Task.CompletedTask); }
public Task SetSelf(INonReentrantGrain self) { logger.Info("SetSelf {0}", self); Self = self; return(Task.CompletedTask); }
public Task SetSelf(INonReentrantGrain self) { logger.LogInformation("SetSelf {Self}", self); Self = self; return(Task.CompletedTask); }
public Task SetSelf(INonReentrantGrain self) { logger.Info("SetSelf {0}", self); Self = self; return TaskDone.Done; }
public Task SetSelf(INonReentrantGrain self) { logger.Info("SetSelf {0}", self); Self = self; return(TaskDone.Done); }
public Task <int> PingSelfThroughOtherInterleaving(INonReentrantGrain target, int t) { return(target.PingOther(this, t)); }
public Task <int> PingOther(INonReentrantGrain target, int t) { return(target.Ping(t)); }