/// <summary> /// Shuts down the singleton instance. /// </summary> public static void ShutDown() { lock (instanceLock) { if (instance == null) return; instance.Dispose(); instance = null; } }
/// <summary> /// Initializes the singleton queue manager. /// </summary> /// <param name="catalogLocation">File name where the queue metadata is stored.</param> /// <param name="persistLocation">Folder where messages are persisted.</param> /// <param name="transitLocation"> /// Folder where messages are temporarily kept /// during dequeue until committed. /// </param> /// <param name="transitCleanupInterval"> /// Period in milliseconds used to scan and /// cleanup (i.e. re-queue) uncommitted messages. /// </param> /// <param name="transitMaximumAge"> /// For uncommitted messages, the maximum number of /// milliseconds they stay that way before being cleaned up (i.e. re-queued). /// </param> public static void Initialize(string catalogLocation, string persistLocation, string transitLocation, int transitCleanupInterval, int transitMaximumAge) { lock (instanceLock) { if (instance != null) return; try { instance = new QueueManager(catalogLocation, persistLocation, transitLocation, transitCleanupInterval, transitMaximumAge); } catch (Exception ex) { ErrorLogger.Log(ex); throw new FaultException<QueueErrorInfo>( QueueErrorInfo.FromErrorCode(QueueErrorCode.ServerInitializationFailed)); } } }