public void DefaultClusterTestOne()
        {
            TraceLogger logger = new TraceLogger();
            DefaultCluster cluster = new DefaultCluster();
            cluster.Logger = logger;
            cluster.MaximumRetries = 1;
            cluster.Name = "TestCluster";
            SizeControlledClientPool pool = new SizeControlledClientPool();
            pool.Name = "TestPool";
            pool.ClientFactory = new MyClientFactory();
            pool.DueTime = 2000;
            MyEndpointManager endpointManager = new MyEndpointManager();
            endpointManager.Name = "Endpoint";
            endpointManager.Endpoints = new List<IEndpoint>();
            endpointManager.Endpoints.Add(new DefaultEndpoint() { Address = "127.0.0.1", Port = 9160, Timeout = 1000, UpDateTime=DateTime.Now });
            pool.EndpointManager = endpointManager;
            pool.Logger = logger;
            pool.MagicNumber = 7;
            pool.MaximumClientsToSupport = 10;
            pool.MaximumRetriesToPollClient = 1;
            pool.MinimumClientsToKeep = 1;
            pool.PeriodicTime = 2000;
            cluster.PoolManager = pool;

            for (int i = 0; i < 100; i++)
            {
                IClient client = cluster.Borrow();
                cluster.Release(client);
            }
        }
Beispiel #2
0
 public AquilesHelper(AbstractAquilesClusterBuilder builder, string sectionConfigurationName)
 {
     AquilesConfigurationSection section = (AquilesConfigurationSection)ConfigurationManager.GetSection(sectionConfigurationName);
     if (section != null)
     {
         ILogger logger = new TraceLogger();
         if (section.LoggingManager != null && section.LoggingManager.Text != null && !String.IsNullOrEmpty(section.LoggingManager.Text))
         {
             // I got some logger configured
             logger = this.CreateLogger(section.LoggingManager.Text);
         }
         this.Clusters = this.buildClusters(builder, section, logger);
     }
     else
     {
         throw new AquilesConfigurationException("Configuration Section not found for '" + sectionConfigurationName + "'");
     }
 }