Validate() public static method

Validate parameters of connection config. Will throw exceptions if parameters are incorrect.

public static Validate ( ConnectionConfig config ) : void
config ConnectionConfig
return void
 /// <summary>
 ///   <para>Create topology.</para>
 /// </summary>
 /// <param name="defaultConfig">Default config.</param>
 /// <param name="maxDefaultConnections">Maximum default connections.</param>
 public HostTopology(ConnectionConfig defaultConfig, int maxDefaultConnections)
 {
     if (defaultConfig == null)
     {
         throw new NullReferenceException("config is not defined");
     }
     if (maxDefaultConnections <= 0)
     {
         throw new ArgumentOutOfRangeException("maxDefaultConnections", "count connection should be > 0");
     }
     if (maxDefaultConnections > 65535)
     {
         throw new ArgumentOutOfRangeException("maxDefaultConnections", "count connection should be < 65535");
     }
     ConnectionConfig.Validate(defaultConfig);
     this.m_DefConfig         = new ConnectionConfig(defaultConfig);
     this.m_MaxDefConnections = maxDefaultConnections;
 }
Exemplo n.º 2
0
 public HostTopology(ConnectionConfig defaultConfig, int maxDefaultConnections)
 {
     this.m_SpecialConnections          = new List <ConnectionConfig>();
     this.m_ReceivedMessagePoolSize     = 0x80;
     this.m_SentMessagePoolSize         = 0x80;
     this.m_MessagePoolSizeGrowthFactor = 0.75f;
     if (defaultConfig == null)
     {
         throw new NullReferenceException("config is not defined");
     }
     if (maxDefaultConnections <= 0)
     {
         throw new ArgumentOutOfRangeException("maxDefaultConnections", "count connection should be > 0");
     }
     if (maxDefaultConnections > 0xffff)
     {
         throw new ArgumentOutOfRangeException("maxDefaultConnections", "count connection should be < 65535");
     }
     ConnectionConfig.Validate(defaultConfig);
     this.m_DefConfig         = new ConnectionConfig(defaultConfig);
     this.m_MaxDefConnections = maxDefaultConnections;
 }
Exemplo n.º 3
0
        public HostTopology(ConnectionConfig defaultConfig, int maxDefaultConnections)
        {
            bool flag = defaultConfig == null;

            if (flag)
            {
                throw new NullReferenceException("config is not defined");
            }
            bool flag2 = maxDefaultConnections <= 0;

            if (flag2)
            {
                throw new ArgumentOutOfRangeException("maxConnections", "Number of connections should be > 0");
            }
            bool flag3 = maxDefaultConnections >= 65535;

            if (flag3)
            {
                throw new ArgumentOutOfRangeException("maxConnections", "Number of connections should be < 65535");
            }
            ConnectionConfig.Validate(defaultConfig);
            this.m_DefConfig         = new ConnectionConfig(defaultConfig);
            this.m_MaxDefConnections = maxDefaultConnections;
        }