/// <summary> /// Initializes the reload config. /// </summary> /// <param name="config">The config.</param> /// <param name="isInit">if set to <c>true</c> [is init].</param> internal void InitializeReloadConfig(RelayNodeConfig config, bool isInit) { #region Set Component Configs if (config == null) { Exception ex = new Exception("Unable to Initialize/Reload Config for CacheIndexV3Store because RelayNodeConfig is null"); LoggingUtil.Log.Error(ex.Message); throw ex; } Interlocked.Exchange(ref nodeConfig, config); Interlocked.Exchange(ref storageConfiguration, InitializeConfig(nodeConfig)); #endregion #region Setup Forwarder if (ForwarderComponent == null) { ForwarderComponent = new Forwarder(); ForwarderComponent.Initialize(config, null); } else { ForwarderComponent.ReloadConfig(config); } #endregion #region Init/Reload Component if (IndexStorageComponent == null) { IndexStorageComponent = InitializeStorageComponent(storageConfiguration.BerkeleyDbConfig); } else { ReloadStorageComponent(storageConfiguration.BerkeleyDbConfig, IndexStorageComponent); } #endregion #region init DataMembers Interlocked.Exchange(ref relatedTypeIds, InitializeRelatedTypeIds(nodeConfig)); Interlocked.Exchange(ref compressOptions, InitializeCompressOptions(nodeConfig)); InitializeClusterInfo(out myClusterPosition, out numClustersInGroup, out myZone); LockingUtil.Instance.InitializeLockerObjects(storageConfiguration.CacheIndexV3StorageConfig.LockMultiplier, numClustersInGroup); LegacySerializationUtil.Instance.InitializeLegacySerializtionTypes(nodeConfig.TypeSettings, storageConfiguration.CacheIndexV3StorageConfig.SupportLegacySerialization); List<short> typeIdList = new List<short>(); #region Index Capping Check // Index Capping feature for multiple indexes not supported // TBD - Remove this check when feature is supported foreach (IndexTypeMapping indexTypeMapping in storageConfiguration.CacheIndexV3StorageConfig.IndexTypeMappingCollection) { typeIdList.Add(indexTypeMapping.TypeId); if (indexTypeMapping.IndexCollection.Count > 1 && indexTypeMapping.IndexServerMode == IndexServerMode.Databound) { foreach (Index indexInfo in indexTypeMapping.IndexCollection) { if (indexInfo.MaxIndexSize > 0) { LoggingUtil.Log.ErrorFormat("TypeId {0} -- Index Capping feature for multiple indexes not supported", indexTypeMapping.TypeId); throw new Exception("Index Capping feature for multiple indexes not supported"); } } } } #endregion #region init performance counters // get the max type id short maxTypeId = config.TypeSettings.MaxTypeId; // initialize or re-initialize performance counters, // counter category will also be created if it is not there PerformanceCounters.Instance.InitializeCounters( config.TransportSettings.ListenPort, typeIdList, maxTypeId, isInit); #endregion #region Set HashCollections Interlocked.Exchange(ref tagHashCollection, InitializeTagHashCollection(storageConfiguration)); Interlocked.Exchange(ref stringHashCollection, InitializeStringHashCollection(storageConfiguration)); #endregion #endregion }
internal SimpleLinkedList <Node> GetNodesForMessage(RelayMessage message) { SimpleLinkedList <Node> nodes = null; if (message == null || message.RelayTTL < 1 || NodeGroups == null) { return(new SimpleLinkedList <Node>()); } const bool useLegacySerialization = true; //commands that, from out of system, route to all groups if (message.IsGroupBroadcastMessage) { message.PrepareMessageToBeSent(useLegacySerialization); if (MyNodeGroup == null) //out of system: all groups { nodes = new SimpleLinkedList <Node>(); for (int groupIndex = 0; groupIndex < this.NodeGroups.Count; groupIndex++) { nodes.Push(NodeGroups[groupIndex].GetNodesForMessage(message)); } } else //In system: my group { nodes = MyNodeGroup.MyCluster.GetNodesForMessage(message); } } else { //Commands that always route to a single group NodeGroup group = GetNodeGroup(message.TypeId); if (group != null) { message.PrepareMessageToBeSent(group.GroupDefinition.LegacySerialization); nodes = group.GetNodesForMessage(message); } else { message.PrepareMessageToBeSent(useLegacySerialization); if (_log.IsErrorEnabled) { _log.ErrorFormat("No group found for {0}", message); } nodes = new SimpleLinkedList <Node>(); } } if (nodes == null) { nodes = new SimpleLinkedList <Node>(); } // If no nodes are returned, we predict that the caller // will drop the message. Therefore we call the notification delegate. // This is admittedly a kludgy solution, but the only one // available without changing this method's signature. // A better solution should be adopted. [tchow 01/29/2008] if (nodes.Count == 0) { Forwarder.RaiseMessageDropped(message); } return(nodes); }