本文整理汇总了C#中Akka.Actor.ActorRef.AsInstanceOf方法的典型用法代码示例。如果您正苦于以下问题:C# ActorRef.AsInstanceOf方法的具体用法?C# ActorRef.AsInstanceOf怎么用?C# ActorRef.AsInstanceOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Akka.Actor.ActorRef
的用法示例。
在下文中一共展示了ActorRef.AsInstanceOf方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Send
public override void Send(object message, ActorRef sender)
{
if (sender is LocalActorRef)
{
sender.AsInstanceOf<LocalActorRef>().Provider.DeadLetters.Tell(message);
}
}
示例2: SerializedActorPath
public static string SerializedActorPath(ActorRef @ref)
{
/*
val path = actorRef.path
val originalSystem: ExtendedActorSystem = actorRef match {
case a: ActorRefWithCell ⇒ a.underlying.system.asInstanceOf[ExtendedActorSystem]
case _ ⇒ null
}
Serialization.currentTransportInformation.value match {
case null ⇒ originalSystem match {
case null ⇒ path.toSerializationFormat
case system ⇒
try path.toSerializationFormatWithAddress(system.provider.getDefaultAddress)
catch { case NonFatal(_) ⇒ path.toSerializationFormat }
}
case Information(address, system) ⇒
if (originalSystem == null || originalSystem == system)
path.toSerializationFormatWithAddress(address)
else {
val provider = originalSystem.provider
path.toSerializationFormatWithAddress(provider.getExternalAddressFor(address).getOrElse(provider.getDefaultAddress))
}
}*/
ActorSystem originalSystem = null;
if (@ref is ActorRefWithCell)
{
originalSystem = @ref.AsInstanceOf<ActorRefWithCell>().Underlying.System;
if (CurrentTransportInformation == null)
{
return @ref.Path.ToSerializationFormat();
}
return @ref.Path.ToStringWithAddress(CurrentTransportInformation.Address);
}
return @ref.Path.ToSerializationFormat();
}
示例3: RestartChild
/// <summary>
/// Restarts the child.
/// </summary>
/// <param name="child">The child.</param>
/// <param name="cause">The cause.</param>
/// <param name="suspendFirst">if set to <c>true</c> [suspend first].</param>
private void RestartChild(ActorRef child, Exception cause, bool suspendFirst)
{
var c = child.AsInstanceOf<InternalActorRef>();
if (suspendFirst)
c.Suspend();
c.AsInstanceOf<InternalActorRef>().Restart(cause);
}
示例4: ResumeChild
/// <summary>
/// Resumes the child.
/// </summary>
/// <param name="child">The child.</param>
/// <param name="exception">The exception.</param>
private void ResumeChild(ActorRef child, Exception exception)
{
child.AsInstanceOf<InternalActorRef>().Resume(exception);
}
示例5: ProcessFailure
/// <summary>
/// Processes the failure.
/// </summary>
/// <param name="actorCell">The actor cell.</param>
/// <param name="restart">if set to <c>true</c> [restart].</param>
/// <param name="child">The child.</param>
/// <param name="cause">The cause.</param>
private void ProcessFailure(ActorCell actorCell, bool restart, ActorRef child, Exception cause)
{
if (restart)
{
RestartChild(child, cause, false);
}
else
{
child.AsInstanceOf<InternalActorRef>().Stop();
}
/*
if (children.nonEmpty) {
if (restart && children.forall(_.requestRestartPermission(retriesWindow)))
children foreach (crs ⇒ restartChild(crs.child, cause, suspendFirst = (crs.child != child)))
else
for (c ← children) context.stop(c.child)
}
*/
//if (children.Any())
//{
// if (restart)
// {
// }
// else
// {
// foreach (var child in children)
// {
// child.Stop();
// }
// }
//}
}
示例6: ProcessFailure
protected override void ProcessFailure(ActorCell actorCell, bool restart, ActorRef child, Exception cause)
{
if (restart)
{
foreach (var c in actorCell.GetChildren().ToArray())
{
RestartChild(child, cause, false);
}
}
else
{
foreach (var c in actorCell.GetChildren().ToArray())
{
child.AsInstanceOf<InternalActorRef>().Stop();
}
}
}