Exemplo n.º 1
0
 private Band[] GetLocalBandDefinition()
 {
     Band[] result;
     using (IBandSettingsProvider bandSettingsProvider = this.serviceContext.CreateBandSettingsStorage())
     {
         result = bandSettingsProvider.GetBandSettings().ToArray <Band>();
     }
     return(result);
 }
Exemplo n.º 2
0
        public virtual ILoadBalance CreateLoadBalancer(ILogger logger)
        {
            if (this.Settings.LoadBalanceBlocked)
            {
                throw new AutomaticMailboxLoadBalancingNotAllowedException();
            }
            ILoadBalance result;

            using (IBandSettingsProvider bandSettingsProvider = this.CreateBandSettingsStorage())
            {
                ILoadBalance loadBalance = new BandBasedLoadBalance(bandSettingsProvider.GetBandSettings().ToList <Band>(), logger, this.Settings);
                result = loadBalance;
            }
            return(result);
        }
        protected override LoadBalanceBandSettingsStorageDiagnosableResult ProcessDiagnostic()
        {
            LoadBalanceBandSettingsStorageDiagnosableResult loadBalanceBandSettingsStorageDiagnosableResult = new LoadBalanceBandSettingsStorageDiagnosableResult();
            LoadBalanceBandSettingsStorageDiagnosableResult result;

            using (IBandSettingsProvider bandSettingsProvider = this.anchorContext.CreateBandSettingsStorage())
            {
                if (base.Arguments.ShowPersistedBands)
                {
                    loadBalanceBandSettingsStorageDiagnosableResult.PersistedBands = bandSettingsProvider.GetPersistedBands().ToArray <PersistedBandDefinition>();
                }
                if (base.Arguments.ShowActiveBands)
                {
                    loadBalanceBandSettingsStorageDiagnosableResult.ActiveBands = bandSettingsProvider.GetBandSettings().ToArray <Band>();
                }
                if (base.Arguments.ProcessAction)
                {
                    Band band = base.Arguments.CreateBand();
                    switch (base.Arguments.Action)
                    {
                    case LoadBalanceBandSettingsStorageDiagnosableArguments.BandStorageActionType.Create:
                        loadBalanceBandSettingsStorageDiagnosableResult.ModifiedBand = bandSettingsProvider.PersistBand(band, base.Arguments.Enabled);
                        break;

                    case LoadBalanceBandSettingsStorageDiagnosableArguments.BandStorageActionType.Remove:
                        loadBalanceBandSettingsStorageDiagnosableResult.ModifiedBand = bandSettingsProvider.RemoveBand(band);
                        break;

                    case LoadBalanceBandSettingsStorageDiagnosableArguments.BandStorageActionType.Enable:
                        loadBalanceBandSettingsStorageDiagnosableResult.ModifiedBand = bandSettingsProvider.EnableBand(band);
                        break;

                    case LoadBalanceBandSettingsStorageDiagnosableArguments.BandStorageActionType.Disable:
                        loadBalanceBandSettingsStorageDiagnosableResult.ModifiedBand = bandSettingsProvider.DisableBand(band);
                        break;
                    }
                }
                result = loadBalanceBandSettingsStorageDiagnosableResult;
            }
            return(result);
        }