Dev2.Data.Binary_Objects.DataListRegistar.DisposeScope C# (CSharp) Method

DisposeScope() public static method

Disposes the scope.
public static DisposeScope ( int transactionScopeId, System.Guid rootRequestId, bool doCompact = true ) : void
transactionScopeId int The transaction scope unique identifier.
rootRequestId System.Guid The root request unique identifier.
doCompact bool if set to true [document compact].
return void
        public static void DisposeScope(int transactionScopeId, Guid rootRequestId, bool doCompact = true)
        {
            Task.Run(() =>
            {

                Dev2Logger.Log.Debug("DISPOSING - Transactional scope ID = " + transactionScopeId);
                try
                {
                    lock(Lock)
                    {
                        IList<Guid> theList;
                        if(RegistrationRoster.TryGetValue(transactionScopeId, out theList))
                        {
                            theList.Remove(rootRequestId);
                            BinaryDataListStorageLayer.RemoveAll(theList);

                            // finally reset
                            IList<Guid> dummy;
                            RegistrationRoster.TryRemove(transactionScopeId, out dummy);

                            // now remove children ;)
                            var keyList = ActivityThreadToParentThreadId.Keys.ToList();
                            foreach(var key in keyList)
                            {
                                if(key == transactionScopeId)
                                {
                                    int dummyInt;
                                    ActivityThreadToParentThreadId.TryRemove(transactionScopeId, out dummyInt);
                                }
                            }
                        }
                    }
                }
                catch(Exception e)
                {
                    Dev2Logger.Log.Error("DataListRegistar", e);
                }
                finally
                {
                    // now we need to pack memory to reclaim space ;)
                    if(doCompact)
                    {
                        // turned force off ;)
                        BinaryDataListStorageLayer.CompactMemory(true);
                    }
                }
            });
        }