コード例 #1
0
        public void SetDeploy(Deploy deploy)
        {
            Action <IList <string>, Deploy> add = (path, d) =>
            {
                bool set;
                do
                {
                    var w = _deployments.Value;
                    foreach (var t in path)
                    {
                        var curPath = t;
                        if (string.IsNullOrEmpty(curPath))
                        {
                            throw new IllegalActorNameException(string.Format("Actor name in deployment [{0}] must not be empty", d.Path));
                        }
                        if (!ActorPath.IsValidPathElement(t))
                        {
                            throw new IllegalActorNameException(
                                      string.Format("Illegal actor name [{0}] in deployment [${1}]. Actor paths MUST: not start with `$`, include only ASCII letters and can only contain these special characters: ${2}.", t, d.Path, new String(ActorPath.ValidSymbols)));
                        }
                    }
                    set = _deployments.CompareAndSet(w, w.Insert(path.GetEnumerator(), d));
                } while(!set);
            };
            var elements = deploy.Path.Split('/').Drop(1).ToList();

            add(elements, deploy);
        }
コード例 #2
0
ファイル: Deployer.cs プロジェクト: yesh-nadella/akka.net
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="deploy">TBD</param>
        /// <exception cref="IllegalActorNameException">
        /// This exception is thrown if the actor name in the deployment path is empty or contains invalid ASCII.
        /// Valid ASCII includes letters and anything from <see cref="ActorPath.ValidSymbols"/>. Note that paths
        /// cannot start with the <c>$</c>.
        /// </exception>
        public void SetDeploy(Deploy deploy)
        {
            void add(IList <string> path, Deploy d)
            {
                var w = _deployments.Value;

                foreach (var t in path)
                {
                    if (string.IsNullOrEmpty(t))
                    {
                        throw new IllegalActorNameException($"Actor name in deployment [{d.Path}] must not be empty");
                    }
                    if (!ActorPath.IsValidPathElement(t))
                    {
                        throw new IllegalActorNameException(
                                  $"Illegal actor name [{t}] in deployment [${d.Path}]. Actor paths MUST: not start with `$`, include only ASCII letters and can only contain these special characters: ${new string(ActorPath.ValidSymbols)}.");
                    }
                }
                if (!_deployments.CompareAndSet(w, w.Insert(path, d)))
                {
                    add(path, d);
                }
            }

            var elements = deploy.Path.Split('/').Drop(1).ToList();

            add(elements, deploy);
        }
コード例 #3
0
 private void CheckName(string name)
 {
     if (name == null)
     {
         throw new InvalidActorNameException("Actor name must not be null.");
     }
     if (name.Length == 0)
     {
         throw new InvalidActorNameException("Actor name must not be empty.");
     }
     if (!ActorPath.IsValidPathElement(name))
     {
         throw new InvalidActorNameException(string.Format("Illegal actor name [{0}]. Actor paths MUST: not start with `$`, include only ASCII letters and can only contain these special characters: ${1}.", name, new String(ActorPath.ValidSymbols)));
     }
 }
コード例 #4
0
 private static string CheckName(string name)
 {
     if (name == null)
     {
         throw new InvalidActorNameException("Actor name must not be null.");
     }
     if (name.Length == 0)
     {
         throw new InvalidActorNameException("Actor name must not be empty.");
     }
     if (!ActorPath.IsValidPathElement(name))
     {
         throw new InvalidActorNameException($"Illegal actor name [{name}]. Actor paths MUST: not start with `$`, include only ASCII letters and can only contain these special characters: ${new string(ActorPath.ValidSymbols)}.");
     }
     return(name);
 }