/// <summary> /// Override the start operations so we can register our task processor. /// </summary> /// <param name="vaultPersistent">Non-transactional Vault object.</param> public override void StartOperations(Vault vaultPersistent) { // Set a reference to the current server reference. VaultApplication.CurrentServer = vaultPersistent .GetVaultServerAttachments() .GetCurrent(); // Allow the base to process the start operations. base.StartOperations(vaultPersistent); // Enable polling/processing of the queue. this.TaskQueueManager.EnableTaskPolling(true); }
/// <summary> /// Ensures that <see cref="CurrentServer"/> is set correctly. /// </summary> /// <param name="vaultApplication">The vault application where this code is running.</param> internal static void SetCurrentServer(VaultApplicationBase vaultApplication) { // Sanity. if (null == vaultApplication) { throw new ArgumentNullException(nameof(vaultApplication)); } // Ensure that we have a current server. lock (TaskQueueBackgroundOperationManager._lock) { if (null == TaskQueueBackgroundOperationManager.CurrentServer) { TaskQueueBackgroundOperationManager.CurrentServer = vaultApplication .PermanentVault? .GetVaultServerAttachments()? .GetCurrent(); } } }