Example #1
0
        public void NewCluster(string clusterId, int numSilos, Action <ClusterConfiguration> customizer = null)
        {
            lock (Clusters)
            {
                var myCount = Clusters.Count;

                WriteLog("Starting Cluster {0}  ({1})...", myCount, clusterId);

                if (myCount == 0)
                {
                    TestingSiloHost.StopAllSilosIfRunning();
                    this.siloHost = TestingSiloHost.CreateUninitialized();
                }

                var silohandles = new SiloHandle[numSilos];

                var options = new TestingSiloOptions
                {
                    StartClient   = false,
                    AdjustConfig  = customizer,
                    BasePort      = GetPortBase(myCount),
                    ProxyBasePort = GetProxyBase(myCount)
                };
                silohandles[0] = TestingSiloHost.StartOrleansSilo(this.siloHost, Silo.SiloType.Primary, options, 0);

                Parallel.For(1, numSilos, paralleloptions, i =>
                {
                    silohandles[i] = TestingSiloHost.StartOrleansSilo(this.siloHost, Silo.SiloType.Secondary, options, i);
                });

                Clusters[clusterId] = new ClusterInfo
                {
                    Silos          = silohandles.ToList(),
                    SequenceNumber = myCount
                };

                if (myCount == 0)
                {
                    gossipStabilizationTime = GetGossipStabilizationTime(this.siloHost.Globals);
                }

                WriteLog("Cluster {0} started. [{1}]", clusterId, string.Join(" ", silohandles.Select(s => s.ToString())));
            }
        }
Example #2
0
        public void NewCluster(string clusterid, int numSilos, Action <ClusterConfiguration> customizer = null)
        {
            lock (Clusters)
            {
                WriteLog("Starting Cluster {0}...", clusterid);

                var mycount = Clusters.Count;
                if (mycount == 0)
                {
                    TestingSiloHost.StopAllSilosIfRunning();
                    this.siloHost = TestingSiloHost.CreateUninitialized();
                }

                var silohandles = new SiloHandle[numSilos];

                var options = new TestingSiloOptions
                {
                    StartClient   = false,
                    AdjustConfig  = customizer,
                    BasePort      = GetPortBase(mycount),
                    ProxyBasePort = GetProxyBase(mycount)
                };
                silohandles[0] = TestingSiloHost.StartOrleansSilo(this.siloHost, Silo.SiloType.Primary, options, 0);

                Parallel.For(1, numSilos, i =>
                {
                    silohandles[i] = TestingSiloHost.StartOrleansSilo(this.siloHost, Silo.SiloType.Secondary, options, i);
                });

                Clusters[clusterid] = new ClusterInfo
                {
                    Silos          = silohandles.ToList(),
                    SequenceNumber = mycount
                };

                WriteLog("Cluster {0} started.", clusterid);
            }
        }