public void OnDropDatabase(String database) { IStateTransferTask task = null; lock (dbStateTxferMgrMap) { if (dbStateTxferMgrMap.ContainsKey(database)) { task = dbStateTxferMgrMap[database]; dbStateTxferMgrMap.Remove(database); } } if (task != null) { lock (_schMutex) { //we don't know wether dropped database task is waiting or running so just remove it from both :) waitingDBTasks.Remove(database); runningDBTasks.Remove(database); } task.Stop(); } }
internal void OnDropCollection(String collection) { if (LoggerManager.Instance.StateXferLogger != null && LoggerManager.Instance.StateXferLogger.IsInfoEnabled) { LoggerManager.Instance.StateXferLogger.Info("DatabaseStateTransferManager.OnDropCollection()", "collection " + collection + " being dropped"); } IStateTransferTask task = null; lock (_schMutex) { lock (collectionTasksMap) { if (collectionTasksMap.ContainsKey(collection)) { task = collectionTasksMap[collection]; collectionTasksMap.Remove(collection); } } if (task != null) { waitingColTasks.Remove(collection); runningColTasks.Remove(collection); task.Stop(); } } lock (collectionCorresponderMap) { foreach (KeyValuePair <StateTransferIdentity, ICorresponder> pair in collectionCorresponderMap) { if (pair.Key.ColName.Equals(collection, StringComparison.OrdinalIgnoreCase)) { ICorresponder crossponder = collectionCorresponderMap[pair.Key]; if (crossponder != null) { crossponder.Dispose(); if (resourceManager != null) { resourceManager.UnregisterResource(crossponder.ResourceID); } } } } } VerifyDST(); }
public void Stop() { lock (_schMutex) { if (LoggerManager.Instance.StateXferLogger != null && LoggerManager.Instance.StateXferLogger.IsInfoEnabled) { LoggerManager.Instance.StateXferLogger.Info("DatabaseStateTransferManager.Stop()", "State Transfer Stopping for " + this.dbName); } foreach (var ColName in runningColTasks) { IStateTransferTask task = collectionTasksMap[ColName]; if (task != null) { task.Stop(); } } collectionTasksMap.Clear(); if (LoggerManager.Instance.StateXferLogger != null && LoggerManager.Instance.StateXferLogger.IsInfoEnabled) { LoggerManager.Instance.StateXferLogger.Info("DatabaseStateTransferManager.Stop()", "State Transfer Stopped for " + this.dbName); } } lock (collectionCorresponderMap) { foreach (KeyValuePair <StateTransferIdentity, ICorresponder> pair in collectionCorresponderMap) { ICorresponder crossponder = collectionCorresponderMap[pair.Key]; if (crossponder != null) { if (resourceManager != null) { resourceManager.UnregisterResource(crossponder.ResourceID); } crossponder.Dispose(); } } collectionCorresponderMap.Clear(); } }
public void Stop() { lock (dbStateTxferMgrMap) { if (LoggerManager.Instance.StateXferLogger != null && LoggerManager.Instance.StateXferLogger.IsInfoEnabled) { LoggerManager.Instance.StateXferLogger.Info("NodeStateTranferManager.Stop()", "State Transfer Stoping on " + this.context.LocalAddress.ToString()); } if (_resourceManager != null) { _resourceManager.Stop(); } if (_taskAllocator != null) { _taskAllocator.Stop(); } lock (_schMutex) { foreach (var dbName in runningDBTasks) { if (dbStateTxferMgrMap.ContainsKey(dbName)) { IStateTransferTask task = dbStateTxferMgrMap[dbName]; if (task != null) { task.Stop(); } } } } runningDBTasks.Clear(); waitingDBTasks.Clear(); dbStateTxferMgrMap.Clear(); } if (LoggerManager.Instance.StateXferLogger != null && LoggerManager.Instance.StateXferLogger.IsInfoEnabled) { LoggerManager.Instance.StateXferLogger.Info("NodeStateTranferManager.Stop()", "State Transfer Stopped on " + this.context.LocalAddress.ToString()); } }