Example #1
0
        public new void SetUp()
        {
            _restartOnFailureHandler = new RestartOnFailureStrategy();
            _settings = new FailureSettings
            {
                HeartbeatSettings =
                {
                    ReportSkippedHeartbeatsAsFailureWithDebuggerAttached = true,
                    Interval                                             = TimeSpan.FromMilliseconds(100)
                }
            };
            _silo = new SharpRemote.Hosting.OutOfProcessSilo(failureSettings: _settings, failureHandler: _restartOnFailureHandler);

            _startHandle = new ManualResetEvent(false);
        }
Example #2
0
        public void TestStart4()
        {
            const int taskCount      = 16;
            var       failureHandler = new RestartOnFailureStrategy();
            var       tasks          = new Task[taskCount];

            for (int i = 0; i < taskCount; ++i)
            {
                tasks[i] = new Task(() =>
                {
                    using (var silo = new OutOfProcessSilo(failureHandler: failureHandler))
                    {
                        silo.IsProcessRunning.Should().BeFalse();
                        silo.Start();
                        silo.IsProcessRunning.Should().BeTrue();

                        var proxy = silo.CreateGrain <IGetStringProperty>(typeof(GetStringPropertyImplementation));
                        proxy.Value.Should().Be("Foobar");
                    }
                });
                tasks[i].Start();
            }
            Task.WaitAll(tasks);
        }