/// <summary>
 /// Updates existing configuration.
 /// </summary>
 /// <param name="input">The input string in XML format to use to update the existing configuration.</param>
 /// <returns></returns>
 public void Update(string input)
 {
     var xml = ParseXml(new StringReader(input));
     var disallowed = new List<string>();
     CheckSubtree(updatableXml, xml, "", disallowed);
     if (disallowed.Count > 0)
         throw new ArgumentException("Cannot update configuration with" + disallowed.ToStrings());
     var dict = ToChildDictionary(xml);
     XmlElement globals;
     if (dict.TryGetValue("Globals", out globals))
     {
         Globals.Load(globals);
         ConfigChanged("Globals");
         foreach (var key in ToChildDictionary(globals).Keys)
         {
             ConfigChanged("Globals/" + key);
         }
     }
     XmlElement defaults;
     if (dict.TryGetValue("Defaults", out defaults))
     {
         Defaults.Load(defaults);
         CalculateOverrides();
         ConfigChanged("Defaults");
         foreach (var key in ToChildDictionary(defaults).Keys)
         {
             ConfigChanged("Defaults/" + key);
         }
     }
 }
Example #2
0
        public bool LocalLookup(GrainId grain, out List<ActivationAddress> addresses)
        {
            localLookups.Increment();

            SiloAddress silo = CalculateTargetSilo(grain, false);
            // No need to check that silo != null since we're passing excludeThisSiloIfStopping = false

            if (log.IsVerbose) log.Verbose("Silo {0} tries to lookup for {1}-->{2} ({3}-->{4})", MyAddress, grain, silo, grain.GetUniformHashCode(), silo.GetConsistentHashCode());

            // check if we own the grain
            if (silo.Equals(MyAddress))
            {
                LocalDirectoryLookups.Increment();
                addresses = GetLocalDirectoryData(grain);
                if (addresses == null)
                {
                    // it can happen that we cannot find the grain in our partition if there were 
                    // some recent changes in the membership
                    if (log.IsVerbose2) log.Verbose2("LocalLookup mine {0}=null", grain);
                    return false;
                }
                if (log.IsVerbose2) log.Verbose2("LocalLookup mine {0}={1}", grain, addresses.ToStrings());
                LocalDirectorySuccesses.Increment();
                localSuccesses.Increment();
                return true;
            }

            // handle cache
            cacheLookups.Increment();
            addresses = GetLocalCacheData(grain);
            if (addresses == null)
            {
                if (log.IsVerbose2) log.Verbose2("TryFullLookup else {0}=null", grain);
                return false;
            }
            if (log.IsVerbose2) log.Verbose2("LocalLookup cache {0}={1}", grain, addresses.ToStrings());
            cacheSuccesses.Increment();
            localSuccesses.Increment();
            return true;
        }