using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using SuperSocket.Common;
using System.Collections.Specialized;
using System.Configuration;
namespace SuperSocket.SocketBase.Config
{
///
/// Root configuration model
///
[Serializable]
public partial class RootConfig : IRootConfig
{
///
/// Initializes a new instance of the class.
///
/// The root config.
public RootConfig(IRootConfig rootConfig)
{
rootConfig.CopyPropertiesTo(this);
this.OptionElements = rootConfig.OptionElements;
}
///
/// Initializes a new instance of the class.
///
public RootConfig()
{
int maxWorkingThread, maxCompletionPortThreads;
ThreadPool.GetMaxThreads(out maxWorkingThread, out maxCompletionPortThreads);
MaxWorkingThreads = maxWorkingThread;
MaxCompletionPortThreads = maxCompletionPortThreads;
int minWorkingThread, minCompletionPortThreads;
ThreadPool.GetMinThreads(out minWorkingThread, out minCompletionPortThreads);
MinWorkingThreads = minWorkingThread;
MinCompletionPortThreads = minCompletionPortThreads;
PerformanceDataCollectInterval = 60;
Isolation = IsolationMode.None;
}
#region IRootConfig Members
///
/// Gets/Sets the max working threads.
///
public int MaxWorkingThreads { get; set; }
///
/// Gets/sets the min working threads.
///
public int MinWorkingThreads { get; set; }
///
/// Gets/sets the max completion port threads.
///
public int MaxCompletionPortThreads { get; set; }
///
/// Gets/sets the min completion port threads.
///
public int MinCompletionPortThreads { get; set; }
///
/// Gets/sets the performance data collect interval, in seconds.
///
public int PerformanceDataCollectInterval { get; set; }
///
/// Gets/sets a value indicating whether [disable performance data collector].
///
///
/// true if [disable performance data collector]; otherwise, false.
///
public bool DisablePerformanceDataCollector { get; set; }
///
/// Gets/sets the isolation mode.
///
public IsolationMode Isolation { get; set; }
///
/// Gets/sets the log factory name.
///
///
/// The log factory.
///
public string LogFactory { get; set; }
///
/// Gets/sets the option elements.
///
public NameValueCollection OptionElements { get; set; }
///
/// Gets the child config.
///
/// The type of the config.
/// Name of the child config.
///
public virtual TConfig GetChildConfig(string childConfigName)
where TConfig : ConfigurationElement, new()
{
return this.OptionElements.GetChildConfig(childConfigName);
}
#endregion
}
}