本文整理汇总了C#中Akka.Configuration.Config.SafeWithFallback方法的典型用法代码示例。如果您正苦于以下问题:C# Config.SafeWithFallback方法的具体用法?C# Config.SafeWithFallback怎么用?C# Config.SafeWithFallback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Akka.Configuration.Config
的用法示例。
在下文中一共展示了Config.SafeWithFallback方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestKitBase
private TestKitBase(TestKitAssertions assertions, ActorSystem system, Config config, string actorSystemName, string testActorName)
{
if(assertions == null) throw new ArgumentNullException("assertions");
if(system == null)
{
var configWithDefaultFallback = config.SafeWithFallback(_defaultConfig);
system = ActorSystem.Create(actorSystemName ?? "test", configWithDefaultFallback);
}
_assertions = assertions;
_system = system;
system.RegisterExtension(new TestKitExtension());
system.RegisterExtension(new TestKitAssertionsExtension(assertions));
_testKitSettings = TestKitExtension.For(_system);
_queue = new BlockingQueue<MessageEnvelope>();
_log = Logging.GetLogger(system, GetType());
_eventFilterFactory = new EventFilterFactory(this);
if (string.IsNullOrEmpty(testActorName))
testActorName = "testActor" + _testActorId.IncrementAndGet();
var testActor = CreateTestActor(system, testActorName);
//Wait for the testactor to start
AwaitCondition(() =>
{
var repRef = testActor as RepointableRef;
return repRef == null || repRef.IsStarted;
}, TimeSpan.FromSeconds(5), TimeSpan.FromMilliseconds(10));
if(!(this is NoImplicitSender))
{
InternalCurrentActorCellKeeper.Current = (ActorCell)((ActorRefWithCell)testActor).Underlying;
}
_testActor = testActor;
}
示例2: TestKitBase
private TestKitBase(TestKitAssertions assertions, ActorSystem system, Config config, string actorSystemName = null)
{
if(assertions == null) throw new ArgumentNullException("assertions");
if(system == null)
{
var configWithDefaultFallback = config.SafeWithFallback(_defaultConfig);
system = ActorSystem.Create(actorSystemName ?? "test", configWithDefaultFallback);
}
_assertions = assertions;
_system = system;
system.RegisterExtension(new TestKitExtension());
system.RegisterExtension(new TestKitAssertionsExtension(assertions));
_testKitSettings = TestKitExtension.For(_system);
_queue = new BlockingQueue<MessageEnvelope>();
_log = Logging.GetLogger(system, GetType());
var testActor = CreateTestActor(system, "testActor" + _testActorId.IncrementAndGet());
_testActor = testActor;
//Wait for the testactor to start
AwaitCondition(() =>
{
var repRef = _testActor as RepointableRef;
return repRef == null || repRef.IsStarted;
}, TimeSpan.FromSeconds(1), TimeSpan.FromMilliseconds(10));
}
示例3: TestKitBase
private TestKitBase(ITestKitAssertions assertions, ActorSystem system, Config config, string actorSystemName, string testActorName)
{
if(assertions == null) throw new ArgumentNullException("assertions");
if(system == null)
{
var configWithDefaultFallback = config.SafeWithFallback(_defaultConfig);
system = ActorSystem.Create(actorSystemName ?? "test", configWithDefaultFallback);
}
_assertions = assertions;
_system = system;
system.RegisterExtension(new TestKitExtension());
system.RegisterExtension(new TestKitAssertionsExtension(assertions));
_testKitSettings = TestKitExtension.For(_system);
_queue = new BlockingQueue<MessageEnvelope>();
_log = Logging.GetLogger(system, GetType());
_eventFilterFactory = new EventFilterFactory(this);
//register the CallingThreadDispatcherConfigurator
_system.Dispatchers.RegisterConfigurator(CallingThreadDispatcher.Id,
new CallingThreadDispatcherConfigurator(_system.Settings.Config, _system.Dispatchers.Prerequisites));
if (string.IsNullOrEmpty(testActorName))
testActorName = "testActor" + _testActorId.IncrementAndGet();
var testActor = CreateTestActor(system, testActorName);
//Wait for the testactor to start
AwaitCondition(() =>
{
var repRef = testActor as IRepointableRef;
return repRef == null || repRef.IsStarted;
}, TimeSpan.FromSeconds(5), TimeSpan.FromMilliseconds(10));
if(!(this is INoImplicitSender))
{
InternalCurrentActorCellKeeper.Current = (ActorCell)((ActorRefWithCell)testActor).Underlying;
}
else if(!(this is TestProbe))
//HACK: we need to clear the current context when running a No Implicit Sender test as sender from an async test may leak
//but we should not clear the current context when creating a testprobe from a test
{
InternalCurrentActorCellKeeper.Current = null;
}
SynchronizationContext.SetSynchronizationContext(
new ActorCellKeepingSynchronizationContext(InternalCurrentActorCellKeeper.Current));
_testActor = testActor;
}
示例4: InjectTopLevelFallback
/// <summary>
/// Injects a system config at the top of the fallback chain
/// </summary>
/// <param name="config"></param>
public void InjectTopLevelFallback(Config config)
{
_fallbackConfig = config.SafeWithFallback(_fallbackConfig);
RebuildConfig();
}