public Process(string name, ActorSystem actorSystem, IActor actor, ActorOptions options) : base(-1, -1) { _name = name; _actor = actor; _actorSystem = actorSystem; _pid = new Pid(this); _ctx = new Context(this); _errorHandler = (options.ErrorHandler ?? actorSystem.Options.ErrorHandler) ?? DefaultErrorHandler.Instance; var requestTimeoutMSec = GetRequestTimeoutMSec(actorSystem, options); _requestTimeoutMSec = !requestTimeoutMSec.HasValue ? (int?)null : Math.Min(Math.Max(-1, requestTimeoutMSec.Value), Constants.MaxRequestTimeoutMSec); SetSequentialInvokeLimit(GetSequentialInvokeLimit(actorSystem, options)); if (options.InitialContextData != null) { foreach (var kv in options.InitialContextData) { _ctx.SetData(kv.Key, kv.Value); } } _processRegistery.TryAdd(_pid, this); }
internal bool TryGetInternal(string actorName, out Pid pid) { pid = null; if (_processRegistery.TryGetValue(actorName, out ProcessRegistery registry)) { pid = registry.Process?.Pid; return(pid != null); } return(false); }
public bool TryGet(string actorName, out Pid pid) { pid = null; actorName = actorName?.Trim(); if (!String.IsNullOrEmpty(actorName)) { return(TryGetInternal(actorName, out pid)); } return(false); }
public bool TryGetRemote(Aid remoteAid, out Pid pid) { pid = null; if (remoteAid != null) { pid = remoteAid as Pid; if (pid?.Process != null) { return(true); } return(TryGetInternal($"remote://{remoteAid.ActorSystem}/{remoteAid.Actor}", out pid)); } return(false); }
public bool TryGetLocal(Aid localAid, out Pid pid) { pid = null; if (localAid != null) { pid = localAid as Pid; if (pid?.Process != null) { return(true); } return(TryGetInternal(localAid.Actor, out pid)); } return(false); }
public static bool TryGet(Aid aid, out Pid pid) { pid = null; if (aid != null) { pid = aid as Pid; if (pid?.Process != null) { return(true); } if (TryGet(aid.ActorSystem, out ActorSystem actorSystem)) { return(actorSystem.TryGetInternal(aid.Actor, out pid) || actorSystem.TryGetInternal($"remote://{aid.ActorSystem}/{aid.Actor}", out pid)); } } return(false); }
public void HandleProcessError(ActorSystem actorSystem, Pid pid, IMessage message, Exception error) { _processErrorHandler(actorSystem, pid, message, error); }
public void HandleProcessError(ActorSystem actorSystem, Pid pid, IMessage message, Exception error) { }
protected override void OnDispose(bool disposing) { _pid = null; _process = null; }
internal Context(Process process) { _process = process; _pid = _process.Pid; }