protected virtual ILoadBalanceService CreateLoadBalancerClient(DirectoryServer server, IDirectoryProvider directory) { ILoadBalanceService result; using (DisposeGuard disposeGuard = default(DisposeGuard)) { LoadBalancerClient loadBalancerClient = LoadBalancerClient.Create(server.Fqdn, directory, this.logger); disposeGuard.Add <LoadBalancerClient>(loadBalancerClient); bool flag = true; ILoadBalanceService loadBalanceService = loadBalancerClient; if (!loadBalancerClient.ServerVersion[1]) { flag = false; loadBalanceService = this.CreateCompatibilityLoadBalanceClient(server); } else if (!loadBalancerClient.ServerVersion[2]) { loadBalanceService = new SoftDeletedRemovalCapabilityDecorator(loadBalanceService, server); } if (!loadBalancerClient.ServerVersion[3]) { loadBalanceService = new ConsumerMetricsLoadBalanceCapabilityDecorator(loadBalanceService, server); } if (!loadBalancerClient.ServerVersion[5]) { loadBalanceService = new CapacitySummaryCapabilityDecorator(loadBalanceService, server, this.serviceContext); } if (flag) { disposeGuard.Success(); } result = loadBalanceService; } return(result); }
protected virtual SoftDeleteMailboxRemovalCheckRemoval GetMailboxRemovalReadiness(NonConnectedMailbox mailbox) { DirectoryIdentity directoryIdentity = DirectoryIdentity.CreateMailboxIdentity(mailbox.Guid, mailbox.OrganizationId, DirectoryObjectType.Mailbox); DirectoryIdentity identity = this.database.Identity; DirectoryDatabase databaseForMailbox; try { databaseForMailbox = this.context.Directory.GetDatabaseForMailbox(directoryIdentity); } catch (RecipientNotFoundException) { return(SoftDeleteMailboxRemovalCheckRemoval.DisallowRemoval("Recipient for mailbox '{0}' and organizationId '{1}' could not be found so removal can not take place", new object[] { directoryIdentity, mailbox.Identity.OrganizationId })); } if (databaseForMailbox == null) { return(SoftDeleteMailboxRemovalCheckRemoval.DisallowRemoval("Could not identify a database for mailbox '{0}' and organizationId '{1}'", new object[] { directoryIdentity, mailbox.Identity.OrganizationId })); } SoftDeletedRemovalData data = new SoftDeletedRemovalData(identity, databaseForMailbox.Identity, directoryIdentity, mailbox.ItemCount, mailbox.DisconnectDate); SoftDeleteMailboxRemovalCheckRemoval result; using (ILoadBalanceService loadBalanceClientForDatabase = this.context.ClientFactory.GetLoadBalanceClientForDatabase(databaseForMailbox)) { result = loadBalanceClientForDatabase.CheckSoftDeletedMailboxRemoval(data); } return(result); }
protected override void ProcessRequest() { using (ILoadBalanceService loadBalanceClientForDatabase = this.clientFactory.GetLoadBalanceClientForDatabase(this.directoryObject)) { loadBalanceClientForDatabase.CleanupSoftDeletedMailboxesOnDatabase(this.directoryObject.Identity, this.targetSize); } }
public Band[] GetActiveBands() { Band[] activeBands; using (ILoadBalanceService loadBalanceClientForCentralServer = this.ClientFactory.GetLoadBalanceClientForCentralServer()) { activeBands = loadBalanceClientForCentralServer.GetActiveBands(); } return(activeBands); }
private void RequestRebalancingOnRemoteServer() { DirectoryDatabase database = (DirectoryDatabase)this.rebalanceRequest.SourceDatabase.DirectoryObject; using (ILoadBalanceService loadBalanceClientForDatabase = this.clientFactory.GetLoadBalanceClientForDatabase(database)) { loadBalanceClientForDatabase.BeginMailboxMove(this.rebalanceRequest, PhysicalSize.Instance); } }
public virtual DatabaseSizeInfo GetSize() { DatabaseSizeInfo databaseSizeInformation; using (ILoadBalanceService loadBalanceClientForDatabase = this.clientFactory.GetLoadBalanceClientForDatabase(this)) { databaseSizeInformation = loadBalanceClientForDatabase.GetDatabaseSizeInformation(base.Identity); } return(databaseSizeInformation); }
public override LoadContainer ExtractTopology() { LoadContainer localServerData; using (ILoadBalanceService loadBalanceClientForServer = this.clientFactory.GetLoadBalanceClientForServer((DirectoryServer)base.DirectoryObject, true)) { localServerData = loadBalanceClientForServer.GetLocalServerData(this.bands); } return(localServerData); }
private HeatMapCapacityData GetServerCapacityDatum(DirectoryIdentity objectIdentity, bool refreshData, DirectoryIdentity localServerIdentity) { if (objectIdentity.Equals(localServerIdentity)) { return(this.serviceContext.LocalServerHeatMap.ToCapacityData()); } DirectoryServer server = (DirectoryServer)this.serviceContext.Directory.GetDirectoryObject(objectIdentity); HeatMapCapacityData capacitySummary; using (ILoadBalanceService loadBalanceClientForServer = this.serviceContext.ClientFactory.GetLoadBalanceClientForServer(server, false)) { capacitySummary = loadBalanceClientForServer.GetCapacitySummary(objectIdentity, refreshData); } return(capacitySummary); }
private HeatMapCapacityData GetDatabaseCapacityDatum(DirectoryIdentity objectIdentity, bool refreshData, DirectoryIdentity localServerIdentity) { DirectoryDatabase directoryDatabase = (DirectoryDatabase)this.serviceContext.Directory.GetDirectoryObject(objectIdentity); DirectoryServer directoryServer = directoryDatabase.ActivationOrder.FirstOrDefault <DirectoryServer>(); if (directoryServer == null || localServerIdentity.Equals(directoryServer.Identity)) { TopologyExtractorFactoryContext topologyExtractorFactoryContext = this.serviceContext.GetTopologyExtractorFactoryContext(); TopologyExtractorFactory loadBalancingLocalFactory = topologyExtractorFactoryContext.GetLoadBalancingLocalFactory(refreshData); LoadContainer loadContainer = loadBalancingLocalFactory.GetExtractor(directoryDatabase).ExtractTopology(); return(loadContainer.ToCapacityData()); } HeatMapCapacityData capacitySummary; using (ILoadBalanceService loadBalanceClientForDatabase = this.serviceContext.ClientFactory.GetLoadBalanceClientForDatabase(directoryDatabase)) { capacitySummary = loadBalanceClientForDatabase.GetCapacitySummary(objectIdentity, refreshData); } return(capacitySummary); }
public BandAsMetricCapabilityDecorator(ILoadBalanceService service, LoadBalanceAnchorContext serviceContext, DirectoryServer targetServer) : base(service, targetServer) { AnchorUtil.ThrowOnNullArgument(serviceContext, "serviceContext"); this.serviceContext = serviceContext; }
public SoftDeletedRemovalCapabilityDecorator(ILoadBalanceService service, DirectoryServer targetServer) : base(service, targetServer) { }
public CapacitySummaryCapabilityDecorator(ILoadBalanceService service, DirectoryServer targetServer, LoadBalanceAnchorContext context) : base(service, targetServer) { this.context = context; }
public CachedLoadBalanceClient(ILoadBalanceService client) : base(client as IWcfClient) { this.client = client; }
public ConsumerMetricsLoadBalanceCapabilityDecorator(ILoadBalanceService service, DirectoryServer targetServer) : base(service, targetServer) { }
protected MissingCapabilityLoadBalanceClientDecorator(ILoadBalanceService service, DirectoryServer targetServer) { this.TargetServer = targetServer; this.service = service; }